mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
removed redux completely
This commit is contained in:
parent
26e6d8d41b
commit
a4bb07e9cf
323 changed files with 2464 additions and 3348 deletions
14
src/hooks/auth/useRestoreCode.ts
Normal file
14
src/hooks/auth/useRestoreCode.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { apiCheckRestoreCode } from '~/api/auth';
|
||||
import useSWR from 'swr';
|
||||
import { API } from '~/constants/api';
|
||||
import { getErrorMessage } from '~/utils/errors/getErrorMessage';
|
||||
|
||||
export const useRestoreCode = (code: string) => {
|
||||
const { data, isValidating, error } = useSWR(API.USER.REQUEST_CODE(code), () =>
|
||||
apiCheckRestoreCode({ code })
|
||||
);
|
||||
|
||||
const codeUser = data?.user;
|
||||
|
||||
return { codeUser, isLoading: isValidating, error: getErrorMessage(error) };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue