Skip to content

Commit

Permalink
[FE] 아티클 에디터 열람 조건 처리 버그를 수정한다 (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
healim01 authored Dec 8, 2024
1 parent eef4710 commit 4499922
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions frontend/src/pages/AdminPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import useToast from '@/hooks/useToast';
import { boxShadowSpread, flexRow, title2, title3 } from '@/styles/common';

const AdminPage = () => {
const { data: user } = useUserQuery();
const { data: user, isFetched } = useUserQuery();
const { showToast } = useToast();
const navigate = useNavigate();

useEffect(() => {
if (user?.userType !== 'ADMIN') {
if (isFetched && user?.userType !== 'ADMIN') {
showToast({ message: '해당 페이지 접근 권한이 없습니다.', type: 'error' });
navigate(ROUTE_PATH.root);
}
}, []);
}, [isFetched]);

return (
<S.PageWrapper>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/roomInfoNonValidatedStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStore } from 'zustand';
import { persist } from 'zustand/middleware';
import { createJSONStorage, persist } from 'zustand/middleware';

import { DEFAULT_POSITION } from '@/constants/map';
import { Position } from '@/types/address';
Expand Down Expand Up @@ -33,7 +33,7 @@ const roomInfoNonValidatedStore = createStore<States & { actions: Actions }>()(
}),
{
name: 'roomInfo-nonvalidated',
getStorage: () => sessionStorage,
storage: createJSONStorage(() => sessionStorage),
partialize: store => {
const { actions: _, ...state } = store;
return { ...state };
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/roomInfoStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStore } from 'zustand';
import { persist } from 'zustand/middleware';
import { createJSONStorage, persist } from 'zustand/middleware';

import { roomFloorLevels, roomOccupancyPeriods } from '@/constants/roomInfo';
import { parseRoomInfo } from '@/hooks/useRoomInfoValidated';
Expand Down Expand Up @@ -99,7 +99,7 @@ export const roomInfoStore = createStore<RoomInfoState & { actions: RoomInfoActi
}),
{
name: 'roomInfo',
getStorage: () => sessionStorage,
storage: createJSONStorage(() => sessionStorage),
partialize: state => {
const { actions: _, ...roomInfo } = state;
return { ...roomInfo };
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/useChecklistStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { createJSONStorage, persist } from 'zustand/middleware';

import { AnswerType } from '@/types/answer';
import { Category } from '@/types/category';
Expand Down Expand Up @@ -119,7 +119,7 @@ const useChecklistStore = create<ChecklistState>()(
}),
{
name: 'checklist-answer',
getStorage: () => sessionStorage,
storage: createJSONStorage(() => sessionStorage),
partialize: ({ checklistCategoryQnA, categories }) => ({
checklistCategoryQnA,
categories,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/useSelectedOptionStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
import { createJSONStorage, persist } from 'zustand/middleware';

import { DEFAULT_OPTIONS, OPTION_COUNT, OPTIONS } from '@/constants/options';

Expand Down Expand Up @@ -66,7 +66,7 @@ const useSelectedOptionStore = create<OptionState & { actions: OptionAction }>()
}),
{
name: 'checklist-answer-option',
getStorage: () => sessionStorage,
storage: createJSONStorage(() => sessionStorage),
partialize: state => ({
selectedOptions: state.selectedOptions,
// actions는 저장하지 않음
Expand Down

0 comments on commit 4499922

Please sign in to comment.