diff --git a/client/src/api/index.ts b/client/src/api/index.ts index bfcb0ee4..b8939f29 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -58,6 +58,8 @@ instance.interceptors.response.use( originalRequest.headers["Authorization"] = `Bearer ${newAccessToken.accessToken}`; return instance(originalRequest); } catch (error) { + await signOut(); + useConnectionStore.getState().logout(); return Promise.reject(error); } } diff --git a/client/src/store/createAuthSlice.ts b/client/src/store/createAuthSlice.ts index 2e9bbe7e..300eeaf7 100644 --- a/client/src/store/createAuthSlice.ts +++ b/client/src/store/createAuthSlice.ts @@ -22,6 +22,7 @@ export const createAuthSlice: StateCreator = logout: () => { set({ email: null, name: null, token: "" }); get().resetOwnedMindMap(); + location.href = "/"; }, setUser: (email: string, name: string, id: number) => { diff --git a/client/src/store/createSharedSlice.ts b/client/src/store/createSharedSlice.ts index 02c02fa2..6df989d9 100644 --- a/client/src/store/createSharedSlice.ts +++ b/client/src/store/createSharedSlice.ts @@ -20,6 +20,7 @@ export const createSharedSlice: StateCreator