39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { useMutation } from '@tanstack/react-query';
|
|
import * as api from '../service/AuthService'
|
|
import type { CheckHasAccountPhoneType, CheckHasAccountType, LoginWithOtpType, LoginWithPasswordType, OtpVerifyType, RegisterType } from '../types/AuthTypes';
|
|
|
|
export const useLoginWithPassword = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: LoginWithPasswordType) => api.loginWithPassword(variables),
|
|
});
|
|
};
|
|
|
|
export const useLoginWithOtp = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: LoginWithOtpType) => api.loginWithOtp(variables),
|
|
});
|
|
};
|
|
|
|
export const useOtpVerify = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: OtpVerifyType) => api.otpVerify(variables),
|
|
});
|
|
};
|
|
|
|
export const useCheckHasAccount = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: CheckHasAccountType) => api.checkHasAccount(variables),
|
|
});
|
|
};
|
|
|
|
export const useCheckHasAccountRegister = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: CheckHasAccountPhoneType) => api.checkHasAccountRegister(variables),
|
|
});
|
|
};
|
|
|
|
export const useRegister = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: RegisterType) => api.register(variables),
|
|
});
|
|
}; |