Skip to content

Commit 3a59795

Browse files
committed
feat: logout if unauthenticated response
1 parent 2506647 commit 3a59795

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

apps/dashboard/src/config/axios.config.ts

+12
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ authenticatedAxios.interceptors.request.use((config) => {
1616

1717
return config;
1818
});
19+
20+
authenticatedAxios.interceptors.response.use(
21+
(response) => response,
22+
(error) => {
23+
if (error.response?.status === 401) {
24+
Cookies.remove('jwt');
25+
window.location.reload();
26+
}
27+
28+
return Promise.reject(error);
29+
}
30+
);

0 commit comments

Comments
 (0)