Skip to content

Commit

Permalink
Merge pull request #171 from BCSDLab/feature/#170
Browse files Browse the repository at this point in the history
[공통] 토큰만료시 로그아웃 로직 추가
  • Loading branch information
MinGu-Jeong authored May 16, 2024
2 parents 42f5127 + 238bd8a commit 022b167
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
9 changes: 7 additions & 2 deletions src/store/loginStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ export const useLoginState = create<LoginState>((set) => ({
me: null,
setMe: async () => {
if (localStorage.getItem('accessToken')) {
const user = await getMe();
set({ me: user });
try {
const user = await getMe();
set({ me: user });
} catch (error) {
localStorage.removeItem('accessToken');
set({ me: null });
}
}
},
deleteMe: () => {
Expand Down

0 comments on commit 022b167

Please sign in to comment.