Files
marzban-dev 6f3fba9b8e Updated
2025-01-13 21:13:23 +03:30

31 lines
573 B
TypeScript

// imports
import { useMutation } from "@tanstack/vue-query";
import { API_ENDPOINTS } from "~/constants";
// types
export type OtpRequest = {
phone: string;
};
const useOtp = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleOtp = async (variables: OtpRequest) => {
const { data } = await axios.post(`${API_ENDPOINTS.account.send_otp}`, variables);
return data;
};
return useMutation({
mutationFn: (variables: OtpRequest) => handleOtp(variables)
});
};
export default useOtp;