mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix : add await to logoutRedirection
This commit is contained in:
parent
57ffe7b8c0
commit
798d126700
@ -62,9 +62,9 @@ export const useLogout = (
|
|||||||
|
|
||||||
return await apiClient.logout();
|
return await apiClient.logout();
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: async () => {
|
||||||
queryClient.removeQueries([CURRENT_USER_KEY]);
|
queryClient.removeQueries([CURRENT_USER_KEY]);
|
||||||
logoutRedirection();
|
await logoutRedirection();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ export const useAxiosInstance = () => {
|
|||||||
// Response Interceptor
|
// Response Interceptor
|
||||||
instance.interceptors.response.use(
|
instance.interceptors.response.use(
|
||||||
(resp) => resp,
|
(resp) => resp,
|
||||||
(error) => {
|
async (error) => {
|
||||||
if (!error.response) {
|
if (!error.response) {
|
||||||
// Optionally redirect to an error page or show a notification
|
// Optionally redirect to an error page or show a notification
|
||||||
toast.error(t("message.network_error"));
|
toast.error(t("message.network_error"));
|
||||||
@ -53,7 +53,7 @@ export const useAxiosInstance = () => {
|
|||||||
return Promise.reject(new Error("Network error"));
|
return Promise.reject(new Error("Network error"));
|
||||||
}
|
}
|
||||||
if (error.response.status === 401) {
|
if (error.response.status === 401) {
|
||||||
logoutRedirection(true);
|
await logoutRedirection(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(error.response.data);
|
return Promise.reject(error.response.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user