new changes

This commit is contained in:
Mamalizz
2025-02-23 23:21:41 +03:30
parent eadcfcdc61
commit 1dcd3647ac
8 changed files with 129 additions and 109 deletions
@@ -6,17 +6,15 @@ import { API_ENDPOINTS } from "~/constants";
// types
export type RefreshAuthRequest = {
refresh: string,
refresh: string;
};
export type RefreshAuthResponse = {
access: string,
refresh: string,
access: string;
refresh: string;
};
const useRefreshAuth = () => {
// state
const { $axios: axios } = useNuxtApp();
@@ -24,12 +22,16 @@ const useRefreshAuth = () => {
// methods
const handleRefreshAuth = async (variables: RefreshAuthRequest) => {
const { data } = await axios.post<RefreshAuthResponse>(`${API_ENDPOINTS.auth.refresh}/`, variables);
const { data } = await axios.post<RefreshAuthResponse>(
`${API_ENDPOINTS.auth.refresh}`,
variables
);
return data;
};
return useMutation({
mutationFn: (variables: RefreshAuthRequest) => handleRefreshAuth(variables)
mutationFn: (variables: RefreshAuthRequest) =>
handleRefreshAuth(variables),
});
};