mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
30 lines
864 B
TypeScript
30 lines
864 B
TypeScript
import { useSelector } from '@xstate/react';
|
|
import { ActorRefFrom } from 'xstate';
|
|
import {
|
|
AddVcModalEvents,
|
|
AddVcModalMachine,
|
|
selectIsAcceptingOtpInput,
|
|
selectIsRequestingCredential,
|
|
selectOtpError,
|
|
selectIsAcceptingIdInput,
|
|
} from './AddVcModalMachine';
|
|
|
|
export function useAddVcModal({ service }: AddVcModalProps) {
|
|
return {
|
|
isRequestingCredential: useSelector(service, selectIsRequestingCredential),
|
|
|
|
otpError: useSelector(service, selectOtpError),
|
|
|
|
isAcceptingUinInput: useSelector(service, selectIsAcceptingIdInput),
|
|
isAcceptingOtpInput: useSelector(service, selectIsAcceptingOtpInput),
|
|
|
|
INPUT_OTP: (otp: string) => service.send(AddVcModalEvents.INPUT_OTP(otp)),
|
|
|
|
DISMISS: () => service.send(AddVcModalEvents.DISMISS()),
|
|
};
|
|
}
|
|
|
|
export interface AddVcModalProps {
|
|
service: ActorRefFrom<typeof AddVcModalMachine>;
|
|
}
|