new changes
This commit is contained in:
@@ -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),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user