Skip to content

Commit

Permalink
[#41] feat: 로그아웃할 때 화면 리프레시 구현
Browse files Browse the repository at this point in the history
- logout할 때 admin 상태가 변경되기 때문에 useEffect로 감지하여 다시 렌더링하도록 합니다.
  • Loading branch information
YehyeokBang committed Apr 9, 2024
1 parent 2fe6885 commit dd650bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/containers/main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
DropdownMenu,
DropdownItem,
Spinner,
Button,
} from "@nextui-org/react";
import { useRecoilValue, useSetRecoilState } from "recoil";
import { adminState } from "@/states/admin";
Expand Down Expand Up @@ -53,7 +52,7 @@ export default function Main() {
});

setIsLoading(true);
}, []);
}, [admin]);

function requestLogout() {
logout();
Expand Down
1 change: 1 addition & 0 deletions src/services/admin/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const getAdminName = async () => {
"Content-Type": "application/json",
"Authorization": `Bearer ${localStorage.getItem("accessToken")} `,
},
timeout: 3000,
});
return response.data as ResponseAdmin;
} catch (error) {
Expand Down

0 comments on commit dd650bd

Please sign in to comment.