From 921ab74433edd1b979998900720f9c9cd18192f7 Mon Sep 17 00:00:00 2001
From: kyuran kim <57716832+gxxrxn@users.noreply.github.com>
Date: Tue, 20 Aug 2024 16:15:43 +0900
Subject: [PATCH] =?UTF-8?q?Revert=20"[#608]=20=ED=8E=98=EC=9D=B4=EC=A7=80?=
=?UTF-8?q?=20=EC=A0=91=EA=B7=BC=20=EA=B6=8C=ED=95=9C=20=EB=B6=80=EC=97=AC?=
=?UTF-8?q?=20(#611)"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 7f1cd2132b60995e39306b6ad52d7aa073c63629.
---
src/app/group/[groupId]/edit/page.tsx | 18 +++++-----
src/app/group/[groupId]/join/page.tsx | 6 ++--
src/app/group/create/page.tsx | 6 +---
src/app/profile/me/add/page.tsx | 8 ++---
src/app/profile/me/edit/page.tsx | 14 ++++----
src/app/profile/me/group/page.tsx | 6 ++--
src/hocs/withAuthRequired.tsx | 36 -------------------
.../profile/group/ProfileGroupContainer.tsx | 9 ++---
8 files changed, 27 insertions(+), 76 deletions(-)
delete mode 100644 src/hocs/withAuthRequired.tsx
diff --git a/src/app/group/[groupId]/edit/page.tsx b/src/app/group/[groupId]/edit/page.tsx
index 607b6ac4..beb48496 100644
--- a/src/app/group/[groupId]/edit/page.tsx
+++ b/src/app/group/[groupId]/edit/page.tsx
@@ -10,10 +10,12 @@ import {
import type { APIGroupDetail, APIEditBookGroup } from '@/types/group';
import { SERVICE_ERROR_MESSAGE } from '@/constants';
-import { isAxiosErrorWithCustomCode } from '@/utils/helpers';
-import useToast from '@/v1/base/Toast/useToast';
+import {
+ checkAuthentication,
+ isAxiosErrorWithCustomCode,
+} from '@/utils/helpers';
-import withAuthRequired from '@/hocs/withAuthRequired';
+import useToast from '@/v1/base/Toast/useToast';
import BookGroupEditDateForm from '@/v1/bookGroup/edit/BookGroupEditDateForm';
import BookGroupEditIntroduceForm from '@/v1/bookGroup/edit/BookGroupEditIntroduceForm';
import BookGroupEditTitleForm from '@/v1/bookGroup/edit/BookGroupEditTitleForm';
@@ -26,15 +28,13 @@ const BookGroupEditPage = ({
}) => {
const router = useRouter();
+ const isAuthenticated = checkAuthentication();
+
const { data: bookGroupData } = useBookGroupEditCurrentInfo(groupId);
const { isOwner, title, description, maxMemberCount, startDate, endDate } =
bookGroupData;
- /**
- * @todo
- * 401 페이지 만들기 (접근 권한이 없어요)
- */
- if (!isOwner) {
+ if (!isAuthenticated || !isOwner) {
notFound();
}
@@ -99,4 +99,4 @@ const BookGroupEditPage = ({
);
};
-export default withAuthRequired(BookGroupEditPage);
+export default BookGroupEditPage;
diff --git a/src/app/group/[groupId]/join/page.tsx b/src/app/group/[groupId]/join/page.tsx
index 08de9554..8750b3bc 100644
--- a/src/app/group/[groupId]/join/page.tsx
+++ b/src/app/group/[groupId]/join/page.tsx
@@ -6,8 +6,6 @@ import { SubmitHandler, useForm } from 'react-hook-form';
import useJoinBookGroup from '@/hooks/group/useJoinBookGroup';
import SSRSafeSuspense from '@/components/SSRSafeSuspense';
-import withAuthRequired from '@/hocs/withAuthRequired';
-
import Loading from '@/v1/base/Loading';
import Input from '@/v1/base/Input';
import InputLength from '@/v1/base/InputLength';
@@ -38,8 +36,6 @@ const JoinBookGroupPage = ({
);
};
-export default withAuthRequired(JoinBookGroupPage);
-
const BookGroupJoinForm = ({ groupId }: { groupId: number }) => {
const router = useRouter();
const { isMember, hasPassword, question, joinBookGroup } =
@@ -104,3 +100,5 @@ const BookGroupJoinForm = ({ groupId }: { groupId: number }) => {
);
};
+
+export default JoinBookGroupPage;
diff --git a/src/app/group/create/page.tsx b/src/app/group/create/page.tsx
index da9a1401..9151feea 100644
--- a/src/app/group/create/page.tsx
+++ b/src/app/group/create/page.tsx
@@ -1,11 +1,7 @@
-'use client';
-
-import withAuthRequired from '@/hocs/withAuthRequired';
-
import CreateBookGroupFunnel from '@/v1/bookGroup/create/CreateBookGroupFunnel';
const GroupCreateFunnelPage = () => {
return
( - WrappedComponent: React.ComponentType
-) => {
- const Component = (props: P) => {
- const router = useRouter();
-
- const [isAuthenticated, setIsAuthenticated] = useState(false);
-
- useEffect(() => {
- const hasAccessToken = checkAuthentication();
-
- if (!hasAccessToken) {
- router.push('/login');
- } else {
- setIsAuthenticated(hasAccessToken);
- }
- }, [router]);
-
- if (!isAuthenticated) {
- return null;
- } else {
- return