Skip to content

Commit

Permalink
feat: accessToken도 세션스토리지에 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
pipisebastian committed Nov 25, 2024
1 parent 8e2f567 commit 059d17e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
10 changes: 0 additions & 10 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import { useRefreshQuery } from "@apis/auth";
import { useErrorStore } from "@stores/useErrorStore";
import { useUserInfo } from "@stores/useUserStore";
import { useEffect } from "react";
import { ErrorModal } from "@components/modal/ErrorModal";
import { WorkSpace } from "@features/workSpace/WorkSpace";
import { useSocketStore } from "./stores/useSocketStore";

const App = () => {
// TODO 라우터, react query 설정
const { id, name, accessToken } = useUserInfo();
const { refetch: refreshToken } = useRefreshQuery();
const { isErrorModalOpen, errorMessage } = useErrorStore();

useEffect(() => {
if (id && name && !accessToken) {
refreshToken();
}
}, []);

useEffect(() => {
const socketStore = useSocketStore.getState();
socketStore.init();
Expand Down
1 change: 1 addition & 0 deletions client/src/stores/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const useUserStore = create<UserStore>()(
partialize: (state) => ({
id: state.id,
name: state.name,
accessToken: state.accessToken,
}),
},
),
Expand Down

0 comments on commit 059d17e

Please sign in to comment.