add refresh token in axios

This commit is contained in:
hamid zarghami
2025-11-22 14:03:52 +03:30
parent 6950e1c3ad
commit 23abb2c8eb
3 changed files with 99 additions and 6 deletions
+8 -2
View File
@@ -6,6 +6,7 @@ import {
type LoginWithPasswordType,
type OtpVerifyType,
type RefreshTokenType,
type RefreshTokenResponse,
type RegisterType,
} from "../types/AuthTypes";
@@ -39,7 +40,12 @@ export const register = async (params: RegisterType) => {
return data;
};
export const refreshToken = async (params: RefreshTokenType) => {
const { data } = await axios.post(`/auth/refresh`, params);
export const refreshToken = async (
params: RefreshTokenType
): Promise<RefreshTokenResponse> => {
const { data } = await axios.post<RefreshTokenResponse>(
`/auth/refresh`,
params
);
return data;
};