From 14e32abc91cb23efa44c5dd846578a76bb04ab0c Mon Sep 17 00:00:00 2001 From: Sumin Date: Tue, 25 Jun 2024 03:04:18 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20modal=20=EB=B9=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=8B=9C=20=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89?= =?UTF-8?q?=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/@modal/(.)modal/detail/edit/page.tsx | 6 ++++++ src/app/@modal/(.)modal/detail/review/page.tsx | 6 ++++++ src/app/@modal/(.)modal/detail/reviewEdit/page.tsx | 5 +++++ src/app/@modal/(.)modal/home/productAdd/page.tsx | 6 ++++++ src/app/@modal/(.)modal/profile/profileEdit/page.tsx | 6 ++++++ .../@modal/(.)modal/profile/userFollowList/page.tsx | 5 +++++ src/app/modal/detail/edit/page.tsx | 6 ++++++ src/app/modal/detail/review/page.tsx | 6 ++++++ src/app/modal/detail/reviewEdit/page.tsx | 5 +++++ src/app/modal/home/productAdd/page.tsx | 6 ++++++ src/app/modal/profile/loginAlert/page.tsx | 12 ------------ src/app/modal/profile/profileEdit/page.tsx | 6 ++++++ src/app/modal/profile/userFollowList/page.tsx | 5 +++++ 13 files changed, 68 insertions(+), 12 deletions(-) delete mode 100644 src/app/modal/profile/loginAlert/page.tsx diff --git a/src/app/@modal/(.)modal/detail/edit/page.tsx b/src/app/@modal/(.)modal/detail/edit/page.tsx index dfa2feb..6b40cc1 100644 --- a/src/app/@modal/(.)modal/detail/edit/page.tsx +++ b/src/app/@modal/(.)modal/detail/edit/page.tsx @@ -1,9 +1,15 @@ import { EditModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductEditModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/@modal/(.)modal/detail/review/page.tsx b/src/app/@modal/(.)modal/detail/review/page.tsx index 867196a..1ec4812 100644 --- a/src/app/@modal/(.)modal/detail/review/page.tsx +++ b/src/app/@modal/(.)modal/detail/review/page.tsx @@ -1,9 +1,15 @@ import { ReviewModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductReviewModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/@modal/(.)modal/detail/reviewEdit/page.tsx b/src/app/@modal/(.)modal/detail/reviewEdit/page.tsx index 85977bc..036165a 100644 --- a/src/app/@modal/(.)modal/detail/reviewEdit/page.tsx +++ b/src/app/@modal/(.)modal/detail/reviewEdit/page.tsx @@ -1,10 +1,15 @@ import { ReviewEditModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductReviewEditModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/@modal/(.)modal/home/productAdd/page.tsx b/src/app/@modal/(.)modal/home/productAdd/page.tsx index 62940db..3de0a3f 100644 --- a/src/app/@modal/(.)modal/home/productAdd/page.tsx +++ b/src/app/@modal/(.)modal/home/productAdd/page.tsx @@ -1,9 +1,15 @@ import { Modal } from '@/shared/ui/Modal'; import { AddModal } from '@/components/Home/modal/AddModal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductAddModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/@modal/(.)modal/profile/profileEdit/page.tsx b/src/app/@modal/(.)modal/profile/profileEdit/page.tsx index 81c64e5..afa774a 100644 --- a/src/app/@modal/(.)modal/profile/profileEdit/page.tsx +++ b/src/app/@modal/(.)modal/profile/profileEdit/page.tsx @@ -1,9 +1,15 @@ import EditModal from '@/components/Profile/modal/EditModal'; import { getUserCookies } from '@/shared/@common/utils/getUserCookies'; import { Modal } from '@/shared/ui/Modal'; +import { redirect } from 'next/navigation'; const ProfileEdit = () => { const { accessToken, loginedId } = getUserCookies(); + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/@modal/(.)modal/profile/userFollowList/page.tsx b/src/app/@modal/(.)modal/profile/userFollowList/page.tsx index e059b40..035c58d 100644 --- a/src/app/@modal/(.)modal/profile/userFollowList/page.tsx +++ b/src/app/@modal/(.)modal/profile/userFollowList/page.tsx @@ -2,11 +2,16 @@ import UserListModal from '@/components/Profile/modal/UserListModal'; import { SkeletonUserListModal } from '@/components/Profile/skeleton'; import { getUserCookies } from '@/shared/@common/utils/getUserCookies'; import { Modal } from '@/shared/ui/Modal'; +import { redirect } from 'next/navigation'; import { Suspense } from 'react'; const UserFollowList = () => { const { accessToken, loginedId } = getUserCookies(); + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( }> diff --git a/src/app/modal/detail/edit/page.tsx b/src/app/modal/detail/edit/page.tsx index dfa2feb..6b40cc1 100644 --- a/src/app/modal/detail/edit/page.tsx +++ b/src/app/modal/detail/edit/page.tsx @@ -1,9 +1,15 @@ import { EditModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductEditModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/modal/detail/review/page.tsx b/src/app/modal/detail/review/page.tsx index 867196a..1ec4812 100644 --- a/src/app/modal/detail/review/page.tsx +++ b/src/app/modal/detail/review/page.tsx @@ -1,9 +1,15 @@ import { ReviewModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductReviewModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/modal/detail/reviewEdit/page.tsx b/src/app/modal/detail/reviewEdit/page.tsx index 85977bc..036165a 100644 --- a/src/app/modal/detail/reviewEdit/page.tsx +++ b/src/app/modal/detail/reviewEdit/page.tsx @@ -1,10 +1,15 @@ import { ReviewEditModal } from '@/components/Detail/modal'; import { Modal } from '@/shared/ui/Modal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductReviewEditModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/modal/home/productAdd/page.tsx b/src/app/modal/home/productAdd/page.tsx index 62940db..3de0a3f 100644 --- a/src/app/modal/home/productAdd/page.tsx +++ b/src/app/modal/home/productAdd/page.tsx @@ -1,9 +1,15 @@ import { Modal } from '@/shared/ui/Modal'; import { AddModal } from '@/components/Home/modal/AddModal'; import { cookies } from 'next/headers'; +import { redirect } from 'next/navigation'; const ProductAddModal = () => { const accessToken = cookies().get('accessToken')?.value ?? ''; + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/modal/profile/loginAlert/page.tsx b/src/app/modal/profile/loginAlert/page.tsx deleted file mode 100644 index 44983c2..0000000 --- a/src/app/modal/profile/loginAlert/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { AlertModal } from '@/components/@common/modal'; -import { Modal } from '@/shared/ui/Modal'; - -const LoginAlert = () => { - return ( - - - - ); -}; - -export default LoginAlert; diff --git a/src/app/modal/profile/profileEdit/page.tsx b/src/app/modal/profile/profileEdit/page.tsx index 81c64e5..afa774a 100644 --- a/src/app/modal/profile/profileEdit/page.tsx +++ b/src/app/modal/profile/profileEdit/page.tsx @@ -1,9 +1,15 @@ import EditModal from '@/components/Profile/modal/EditModal'; import { getUserCookies } from '@/shared/@common/utils/getUserCookies'; import { Modal } from '@/shared/ui/Modal'; +import { redirect } from 'next/navigation'; const ProfileEdit = () => { const { accessToken, loginedId } = getUserCookies(); + + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( diff --git a/src/app/modal/profile/userFollowList/page.tsx b/src/app/modal/profile/userFollowList/page.tsx index e059b40..035c58d 100644 --- a/src/app/modal/profile/userFollowList/page.tsx +++ b/src/app/modal/profile/userFollowList/page.tsx @@ -2,11 +2,16 @@ import UserListModal from '@/components/Profile/modal/UserListModal'; import { SkeletonUserListModal } from '@/components/Profile/skeleton'; import { getUserCookies } from '@/shared/@common/utils/getUserCookies'; import { Modal } from '@/shared/ui/Modal'; +import { redirect } from 'next/navigation'; import { Suspense } from 'react'; const UserFollowList = () => { const { accessToken, loginedId } = getUserCookies(); + if (!accessToken) { + redirect('/modal/common/loginAlert'); + } + return ( }>