From cae9db20d6d9d6e0c6cf4098a75060618aa2bee8 Mon Sep 17 00:00:00 2001 From: gimdogyun Date: Tue, 26 Mar 2024 15:18:04 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=B3=84?= =?UTF-8?q?=20=EA=B6=8C=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - NeedAuth는 회장과 부회장은 무조건 허용하도록 수정 - #888 --- src/components/NeedAuth/NeedAuth.tsx | 6 +- src/router/useMainRouter.tsx | 86 +++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 17 deletions(-) diff --git a/src/components/NeedAuth/NeedAuth.tsx b/src/components/NeedAuth/NeedAuth.tsx index 3b4df861f..60d7c1e03 100644 --- a/src/components/NeedAuth/NeedAuth.tsx +++ b/src/components/NeedAuth/NeedAuth.tsx @@ -6,10 +6,10 @@ import ConfirmModal from '@components/Modal/ConfirmModal'; interface NeedLoginProps { children: JSX.Element; - roles: Role[]; + roles?: Role[]; } -const NeedAuth = ({ children, roles }: NeedLoginProps) => { +const NeedAuth = ({ children, roles = [] }: NeedLoginProps) => { const { checkIncludeOneOfAuths } = useCheckAuth(); const navigate = useNavigate(); @@ -17,7 +17,7 @@ const NeedAuth = ({ children, roles }: NeedLoginProps) => { navigate('/'); }; - if (checkIncludeOneOfAuths(roles)) { + if (checkIncludeOneOfAuths([...roles, 'ROLE_회장', 'ROLE_부회장'])) { return children; } return ( diff --git a/src/router/useMainRouter.tsx b/src/router/useMainRouter.tsx index 945b38e84..8d4813f06 100644 --- a/src/router/useMainRouter.tsx +++ b/src/router/useMainRouter.tsx @@ -22,6 +22,8 @@ import SeminarAttend from '@pages/senimarAttend/SenimarAttend'; import FitContainer from '@components/Layout/Container/FitContainer'; import FullContainer from '@components/Layout/Container/FullContainer'; import MainLayout from '@components/Layout/MainLayout'; +import NeedAuth from '@components/NeedAuth/NeedAuth'; +import NeedLogin from '@components/NeedAuth/NeedLogin'; const useMainRouter = () => useRoutes([ @@ -54,7 +56,11 @@ const useMainRouter = () => }, { path: 'profile/:memberId/*', - element: , + element: ( + + + + ), }, ], }, @@ -66,7 +72,11 @@ const useMainRouter = () => children: [ { path: 'dutyManage', - element: , + element: ( + + + + ), }, /* { path: 'electionManage', @@ -74,19 +84,35 @@ const useMainRouter = () => }, */ { path: 'libraryManage/*', - element: , + element: ( + + + + ), }, { path: 'seminarManage', - element: , + element: ( + + + + ), }, { path: 'activeMemberManage', - element: , + element: ( + + + + ), }, { path: 'meritManage', - element: , + element: ( + + + + ), }, ], }, @@ -95,29 +121,53 @@ const useMainRouter = () => children: [ { path: ':categoryName', - element: , + element: ( + + + + ), }, { path: 'write/:categoryName', - element: , + element: ( + + + + ), }, { path: 'view/:postId', - element: , + element: ( + + + + ), }, ], }, { path: 'study', - element: , + element: ( + + + + ), }, { path: 'library', - element: , + element: ( + + + + ), }, { path: 'seminar', - element: , + element: ( + + + + ), }, /* { path: 'election', @@ -125,11 +175,19 @@ const useMainRouter = () => }, */ { path: 'rank', - element: , + element: ( + + + + ), }, { path: 'game', - element: , + element: ( + + + + ), }, /* { path: 'ctf',