From bd84487596e4eef70eb79e88c9f882f16b103baf Mon Sep 17 00:00:00 2001 From: dongree Date: Sun, 22 Oct 2023 21:02:09 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20create=20series=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=A7=81=EC=A0=91=EB=B0=A9=EB=AC=B8=20=EC=B0=A8?= =?UTF-8?q?=EB=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/create/series/page.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/create/series/page.tsx b/src/app/create/series/page.tsx index 0c17f5f7..630109fd 100644 --- a/src/app/create/series/page.tsx +++ b/src/app/create/series/page.tsx @@ -1,9 +1,10 @@ import SeriesForm from '@/components/create/series/SeriesForm'; import LayoutWrapper from '@/components/shared/LayoutWrapper'; import { checkUser } from '@/service/auth'; -import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const'; +import { ACCESS_TOKEN, MAIN_PATH, REFRESH_TOKEN } from '@/utils/const'; import { Metadata } from 'next'; -import { cookies } from 'next/headers'; +import { cookies, headers } from 'next/headers'; +import { redirect } from 'next/navigation'; export const metadata: Metadata = { title: '시리즈 작성', @@ -11,6 +12,10 @@ export const metadata: Metadata = { }; export default async function CreateSeriesPage() { + const headersList = headers(); + const referer = headersList.get('referer'); + referer === null && redirect(MAIN_PATH); + const accessToken = cookies().get(ACCESS_TOKEN)?.value; const refreshToken = cookies().get(REFRESH_TOKEN)?.value; const cookie = `${ACCESS_TOKEN}=${accessToken}; ${REFRESH_TOKEN}=${refreshToken}`;