diff --git a/src/app/team/[teamId]/study/[studyId]/page.tsx b/src/app/team/[teamId]/study/[studyId]/page.tsx index 1e7a3b4..42df1a7 100644 --- a/src/app/team/[teamId]/study/[studyId]/page.tsx +++ b/src/app/team/[teamId]/study/[studyId]/page.tsx @@ -144,6 +144,7 @@ const Page = ({ params }: { params: { teamId: number; studyId: number } }) => { {documentArray.map((data) => ( {currentData.map((data) => ( !prev); }; + const user = useGetUser(); + const [isMember, setIsMember] = useState(false); + const { result: teamMembers } = useGetFetchWithToken(getTeamMembers, [document?.teamId], user); + + useEffect(() => { + if (user?.isLogin) { + setIsMember(teamMembers?.some((member: Member) => member.id === user.memberId)); + } + }, [teamMembers, user]); + + if (!isMember) { + return ( + setIsDocsModalOpen(false)} title="접근 권한이 없습니다." size="sm"> + {user?.isLogin ? '팀원만 접근 가능합니다.' : '로그인 후 접근 가능합니다.'} + + ); + } + return ( {} }: DocumentGridV {documentArray?.map((document) => { return (