Add send otp api
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// imports
|
||||
|
||||
import { useMutation } from "@tanstack/vue-query";
|
||||
import axios from "~/configs/axios.config";
|
||||
import { API_ENDPOINTS } from "~/constants";
|
||||
|
||||
// types
|
||||
|
||||
export type OtpRequest = {
|
||||
phone: string;
|
||||
};
|
||||
|
||||
// methods
|
||||
|
||||
export const handleOtp = async (variables: OtpRequest) => {
|
||||
const { data } = await axios.post<OtpRequest>(`${API_ENDPOINTS.account.send_otp}`, variables);
|
||||
return data;
|
||||
};
|
||||
|
||||
// composable
|
||||
|
||||
const useOtp = () => {
|
||||
return useMutation({
|
||||
mutationFn: (variables: OtpRequest) => handleOtp(variables)
|
||||
});
|
||||
};
|
||||
|
||||
export default useOtp;
|
||||
Reference in New Issue
Block a user