diff --git a/src/app/create/memo/page.tsx b/src/app/create/memo/page.tsx index d171bf0d..f0caeea7 100644 --- a/src/app/create/memo/page.tsx +++ b/src/app/create/memo/page.tsx @@ -1,7 +1,7 @@ import EditorForm from '@/components/create/memo/EditorForm'; 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, headers } from 'next/headers'; import { redirect } from 'next/navigation'; @@ -12,9 +12,9 @@ export const metadata: Metadata = { }; export default async function CreateMemoPage() { - // const headersList = headers(); - // const referer = headersList.get('referer'); - // referer === null && redirect('/memos'); + 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; diff --git a/src/app/create/question/page.tsx b/src/app/create/question/page.tsx index bed9c9d4..a0713b77 100644 --- a/src/app/create/question/page.tsx +++ b/src/app/create/question/page.tsx @@ -1,5 +1,6 @@ import QuestionEditorForm from '@/components/create/QuestionEditorForm'; import LayoutWrapper from '@/components/shared/LayoutWrapper'; +import { MAIN_PATH } from '@/utils/const'; import { Metadata } from 'next'; import { headers } from 'next/headers'; import { redirect } from 'next/navigation'; @@ -12,7 +13,7 @@ export const metadata: Metadata = { export default function CreateMemoPage() { const headersList = headers(); const referer = headersList.get('referer'); - referer === null && redirect('/memos'); + referer === null && redirect(MAIN_PATH); return ( diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index c36be681..ef1d4e33 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -4,6 +4,7 @@ import { Metadata } from 'next'; import Link from 'next/link'; import logo from '@/assets/inforum_logo.png'; import Image from 'next/image'; +import { MAIN_PATH } from '@/utils/const'; export const metadata: Metadata = { title: '로그인', @@ -14,7 +15,7 @@ export default function LoginPage() { return (
메인으로 diff --git a/src/app/me/[slug]/drafts/page.tsx b/src/app/me/[slug]/drafts/page.tsx index 1b12a7aa..775b079a 100644 --- a/src/app/me/[slug]/drafts/page.tsx +++ b/src/app/me/[slug]/drafts/page.tsx @@ -4,7 +4,7 @@ import LayoutWrapper from '@/components/shared/LayoutWrapper'; import MeDraftContainer from '@/components/me/MeDraftContainer'; import { checkUser, getUserInfo } from '@/service/auth'; import { cookies } from 'next/headers'; -import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const'; +import { ACCESS_TOKEN, MAIN_PATH, REFRESH_TOKEN } from '@/utils/const'; import { Metadata } from 'next'; import { redirect } from 'next/navigation'; import { getNotificationsTop30 } from '@/service/notification'; @@ -29,15 +29,17 @@ export default async function MeDraftPage({ params: { slug } }: Props) { ? await getUserInfo(id) : { profileImageFilePath: undefined }; - const notifications = isLogin - ? await getNotificationsTop30(cookie) - : []; + const notifications = isLogin ? await getNotificationsTop30(cookie) : []; - id !== Number(slug) && redirect('/memos'); + id !== Number(slug) && redirect(MAIN_PATH); return (
-
+
diff --git a/src/app/me/setting/[slug]/page.tsx b/src/app/me/setting/[slug]/page.tsx index 373df9db..b607cfdf 100644 --- a/src/app/me/setting/[slug]/page.tsx +++ b/src/app/me/setting/[slug]/page.tsx @@ -1,6 +1,7 @@ import MyInfoForm from '@/components/MyInfoForm'; import { getUserInfo } from '@/service/auth'; import { getDefaultTags } from '@/service/tag'; +import { MAIN_PATH } from '@/utils/const'; import { Metadata } from 'next'; import { headers } from 'next/headers'; import { redirect } from 'next/navigation'; @@ -14,7 +15,7 @@ type Props = { export default async function MySettingPage({ params: { slug } }: Props) { const headersList = headers(); const referer = headersList.get('referer'); - if (referer === null) redirect('/memos'); + if (referer === null) redirect(MAIN_PATH); const userData = getUserInfo(slug); const defaultTagsData = getDefaultTags(); diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index 9d26412f..5aa7f5d1 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -1,6 +1,7 @@ import Image from 'next/image'; import image404 from '@/assets/image404.png'; import Link from 'next/link'; +import { MAIN_PATH } from '@/utils/const'; export default function NotFoundPage() { return ( @@ -8,7 +9,7 @@ export default function NotFoundPage() { image404

페이지를 찾지 못했습니다!

홈으로 가기 diff --git a/src/app/page.tsx b/src/app/page.tsx index a13210bf..81001d0b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,6 +1,6 @@ import LandingContainer from '@/components/landing/LandingContainer'; import { checkUser } from '@/service/auth'; -import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const'; +import { ACCESS_TOKEN, MAIN_PATH, REFRESH_TOKEN } from '@/utils/const'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; @@ -11,7 +11,7 @@ export default async function LandingPage() { const { isLogin } = await checkUser(cookie); - isLogin && redirect('/memos'); + isLogin && redirect(MAIN_PATH); return ; } diff --git a/src/app/signup/nickname/[slug]/page.tsx b/src/app/signup/nickname/[slug]/page.tsx index 8cc5245d..bdf77292 100644 --- a/src/app/signup/nickname/[slug]/page.tsx +++ b/src/app/signup/nickname/[slug]/page.tsx @@ -1,4 +1,5 @@ import NicknameForm from '@/components/signup/NicknameForm'; +import { MAIN_PATH } from '@/utils/const'; import { headers } from 'next/headers'; import { redirect } from 'next/navigation'; @@ -11,7 +12,7 @@ type Props = { export default function SignupNicknameSettingPage({ params: { slug } }: Props) { const headersList = headers(); const referer = headersList.get('referer'); - referer === null && redirect('/memos'); + referer === null && redirect(MAIN_PATH); return ; } diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx index b4004864..46afc9ab 100644 --- a/src/app/signup/page.tsx +++ b/src/app/signup/page.tsx @@ -5,6 +5,7 @@ import logo from '@/assets/inforum_logo.png'; import { join } from 'path'; import fs from 'fs'; import SignupBox from '@/components/signup/SignupBox'; +import { MAIN_PATH } from '@/utils/const'; export const metadata: Metadata = { title: '회원가입', @@ -32,7 +33,7 @@ export default function SignupPage() { return (
메인으로 diff --git a/src/app/signup/setting/[slug]/page.tsx b/src/app/signup/setting/[slug]/page.tsx index c817b241..bf22bcd0 100644 --- a/src/app/signup/setting/[slug]/page.tsx +++ b/src/app/signup/setting/[slug]/page.tsx @@ -4,6 +4,7 @@ import { headers } from 'next/headers'; import { getDefaultTags } from '@/service/tag'; import logo from '@/assets/inforum_logo.png'; import Image from 'next/image'; +import { MAIN_PATH } from '@/utils/const'; type Props = { params: { @@ -12,10 +13,10 @@ type Props = { }; export default async function SignupSettingPage({ params: { slug } }: Props) { - // const headersList = headers(); - // const referer = headersList.get('referer'); + const headersList = headers(); + const referer = headersList.get('referer'); - // if (referer === null) redirect('/memos'); + if (referer === null) redirect(MAIN_PATH); const defaultTags = await getDefaultTags(); diff --git a/src/components/MyInfoForm.tsx b/src/components/MyInfoForm.tsx index 24773411..69287d77 100644 --- a/src/components/MyInfoForm.tsx +++ b/src/components/MyInfoForm.tsx @@ -19,7 +19,7 @@ import { checkUser, registerUserInfo, updateUserInfo } from '@/service/auth'; import { UserInfo } from '@/types'; import Tag from './shared/Tag'; import { notifyToast } from '@/service/notify'; -import { MAX_PROFILE_IMAGE_BYTE } from '@/utils/const'; +import { MAIN_PATH, MAX_PROFILE_IMAGE_BYTE } from '@/utils/const'; type Props = { userId: number; @@ -76,7 +76,7 @@ export default function MyInfoForm({ } checkUser().then((data) => { notifyToast(res.message, 'success'); - router.push(data.isLogin ? '/memos' : '/login'); + router.push(data.isLogin ? MAIN_PATH : '/login'); router.refresh(); }); }) @@ -185,7 +185,7 @@ export default function MyInfoForm({
{}} /> {isSignup && ( - + {}} extraStyle="w-full" /> )} diff --git a/src/components/landing/LandingContainer.tsx b/src/components/landing/LandingContainer.tsx index 79b3fd54..a6bbcffe 100644 --- a/src/components/landing/LandingContainer.tsx +++ b/src/components/landing/LandingContainer.tsx @@ -11,6 +11,7 @@ import editUnderline from '@/assets/icons/edit_underline.svg'; import speechBubble from '@/assets/icons/speech_bubble.svg'; import Footer from '@/components/shared/Footer'; import down from '@/assets/icons/down.svg'; +import { MAIN_PATH } from '@/utils/const'; export default function LandingContainer() { const [readyState, setReadyState] = useState(false); @@ -47,7 +48,7 @@ export default function LandingContainer() {
블럭 기반 에디터를 활용해 개발 기록을 간편하게 작성해보세요

- + @@ -122,7 +123,7 @@ export default function LandingContainer() {
긍정적인 개발공간을 만들어보세요.

- + diff --git a/src/components/login/LoginForm.tsx b/src/components/login/LoginForm.tsx index 2af3209d..4f467ab1 100644 --- a/src/components/login/LoginForm.tsx +++ b/src/components/login/LoginForm.tsx @@ -7,6 +7,7 @@ import { ChangeEvent, FormEvent, useState } from 'react'; import BlueBtn from '../shared/btn/BlueBtn'; import { BASIC_INPUT_STYLE } from '@/utils/tailwindcss'; import { notifyToast } from '@/service/notify'; +import { MAIN_PATH } from '@/utils/const'; export default function LoginForm() { const router = useRouter(); @@ -28,7 +29,7 @@ export default function LoginForm() { login(formdata).then((data) => { notifyToast(data.message, data.isSuccess ? 'success' : 'error'); if (data.isSuccess) { - router.push('/memos'); + router.push(MAIN_PATH); router.refresh(); } }); diff --git a/src/components/me/Setting.tsx b/src/components/me/Setting.tsx index 83258452..adbf018a 100644 --- a/src/components/me/Setting.tsx +++ b/src/components/me/Setting.tsx @@ -3,6 +3,7 @@ import { ModalContext } from '@/context/ModalProvider'; import { withdraw } from '@/service/auth'; import { notifyToast } from '@/service/notify'; +import { MAIN_PATH } from '@/utils/const'; import Link from 'next/link'; import { useRouter } from 'next/navigation'; import { useContext } from 'react'; @@ -31,7 +32,7 @@ export default function Setting({ myId }: Props) { return; } notifyToast('성공적으로 탈퇴되었습니다.', 'success'); - router.push('/memos'); + router.push(MAIN_PATH); router.refresh(); }); } diff --git a/src/components/shared/Header.tsx b/src/components/shared/Header.tsx index 10935b2e..efc3955d 100644 --- a/src/components/shared/Header.tsx +++ b/src/components/shared/Header.tsx @@ -19,6 +19,7 @@ import RelativeDate from './RelativeDate'; import { checkNotifications } from '@/service/notification'; import { FaRankingStar } from 'react-icons/fa6'; import '@/styles/headerScrollbar.css'; +import { MAIN_PATH } from '@/utils/const'; type Props = { isLogin: boolean; @@ -66,38 +67,38 @@ export default function Header({ alt="logo" width={120} onClick={() => { - router.push('/memos'); + router.push(MAIN_PATH); router.refresh(); }} className="cursor-pointer absolute left-1 sm:left-3" />
- Memos + Series - Q&A + Memos - Series + Q&A
{isLogin ? ( @@ -249,7 +250,7 @@ export default function Header({ setIsActive(false); open('로그아웃 하시겠습니까?', () => { logout().then(() => { - router.push('/memos'); + router.push(MAIN_PATH); router.refresh(); }); }); @@ -287,31 +288,31 @@ export default function Header({
- Memos + Series - Questions + Memos - Series + Questions
diff --git a/src/utils/const.ts b/src/utils/const.ts index 3b7b471a..924d22ea 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -29,3 +29,5 @@ export const MAX_IMAGE_BYTE = 10485760; export const MEMO_NUMBER_PER_PAGE_FOR_INFINITY_SCROLL = 20; export const SERIES_NUMBER_PER_PAGE_FOR_INFINITY_SCROLL = 20; export const QUESTION_NUMBER_PER_PAGE_FOR_INFINITY_SCROLL = 10; + +export const MAIN_PATH = '/series';