Files
dmenu-admin/src/pages/auth/service/AuthService.ts
T
hamid zarghami 14b0e112a2 fix route refresh
2025-12-04 09:28:36 +03:30

52 lines
1.4 KiB
TypeScript

import axios from "../../../config/axios";
import {
type CheckHasAccountPhoneType,
type CheckHasAccountType,
type LoginWithOtpType,
type LoginWithPasswordType,
type OtpVerifyType,
type RefreshTokenType,
type RefreshTokenResponse,
type RegisterType,
} from "../types/AuthTypes";
export const loginWithPassword = async (params: LoginWithPasswordType) => {
const { data } = await axios.post(`/auth/login/password/admin`, params);
return data;
};
export const loginWithOtp = async (params: LoginWithOtpType) => {
const { data } = await axios.post(`/admin/auth/otp/request`, params);
return data;
};
export const otpVerify = async (params: OtpVerifyType) => {
const { data } = await axios.post(`/admin/auth/otp/verify`, params);
return data;
};
export const checkHasAccount = async (params: CheckHasAccountType) => {
const { data } = await axios.post(`/auth/check`, params);
return data;
};
export const checkHasAccountRegister = async (
params: CheckHasAccountPhoneType
) => {
const { data } = await axios.post(`/auth/register/initiate`, params);
return data;
};
export const register = async (params: RegisterType) => {
const { data } = await axios.post(`/auth/register/complete`, params);
return data;
};
export const refreshToken = async (
params: RefreshTokenType
): Promise<RefreshTokenResponse> => {
const { data } = await axios.post<RefreshTokenResponse>(
`/admin/auth/refresh`,
params
);
return data;
};