diff --git a/apps/chooz/lib/utils/userStorage.ts b/apps/chooz/lib/utils/userStorage.ts index e81a4036..6a2f8194 100644 --- a/apps/chooz/lib/utils/userStorage.ts +++ b/apps/chooz/lib/utils/userStorage.ts @@ -1,5 +1,3 @@ -"use client"; - export const USER_STORAGE_KEY = "CHOOZ_USER"; interface Token { diff --git a/apps/jurumarble/src/app/layout.tsx b/apps/jurumarble/src/app/layout.tsx index 3fe7bf4c..65c6a297 100644 --- a/apps/jurumarble/src/app/layout.tsx +++ b/apps/jurumarble/src/app/layout.tsx @@ -6,6 +6,7 @@ import type { Metadata } from "next"; import { ToastContainer } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { injectStyle } from "react-toastify/dist/inject-style"; +import AuthProcess from "components/AuthProcess"; export const metadata: Metadata = { title: "주루마블", @@ -24,11 +25,10 @@ export default function RootLayout({ children }: { children: React.ReactNode }) - <> -
- {children} - - +
+ + {children} + diff --git a/apps/jurumarble/src/app/my/components/UseInfoContainer.tsx b/apps/jurumarble/src/app/my/components/UseInfoContainer.tsx index 19c923ed..287e75f2 100644 --- a/apps/jurumarble/src/app/my/components/UseInfoContainer.tsx +++ b/apps/jurumarble/src/app/my/components/UseInfoContainer.tsx @@ -6,7 +6,6 @@ import styled, { css } from "styled-components"; import Image from "next/image"; import { DrinkImage } from "public/images"; import useGetUserInfo from "services/useGetUserInfo"; -import { useRouter } from "next/navigation"; function UserInfoContainer() { const { userInfo } = useGetUserInfo(); @@ -15,9 +14,6 @@ function UserInfoContainer() { const { gender, nickname, yearOfBirth, mbti, imageUrl } = userInfo; - const router = useRouter(); - if (!(gender && yearOfBirth && mbti)) router.replace(Path.REGISTER_PAGE); - const date = new Date(); const age = date.getFullYear() - yearOfBirth; const ageRange = Math.floor(age / 10) * 10; diff --git a/apps/jurumarble/src/app/my/components/VoteItem.tsx b/apps/jurumarble/src/app/my/components/VoteItem.tsx index db9130c0..febc59d7 100644 --- a/apps/jurumarble/src/app/my/components/VoteItem.tsx +++ b/apps/jurumarble/src/app/my/components/VoteItem.tsx @@ -1,6 +1,5 @@ import Path from "lib/Path"; import { useRouter } from "next/navigation"; -import { ExImg1 } from "public/images"; import useBookmarkService from "services/useBookmarkService"; import { Content } from "src/types/vote"; import styled, { css } from "styled-components"; @@ -8,7 +7,6 @@ import ChipContainer from "./ChipContainer"; import VoteDescription from "./VoteDescription"; type Props = Pick; -const getSafeImage = (image: string) => (image.includes("http") ? image : ExImg1); function VoteItem({ voteId, region, title, imageA, imageB }: Props) { const { isBookmark, mutateBookMark } = useBookmarkService(voteId); @@ -27,7 +25,7 @@ function VoteItem({ voteId, region, title, imageA, imageB }: Props) { mutateBookMark={mutateBookMark} isBookmark={isBookmark} /> - + ); } diff --git a/apps/jurumarble/src/components/AuthProcess.tsx b/apps/jurumarble/src/components/AuthProcess.tsx new file mode 100644 index 00000000..97323ccf --- /dev/null +++ b/apps/jurumarble/src/components/AuthProcess.tsx @@ -0,0 +1,17 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import useGetUserInfo from "services/useGetUserInfo"; +import Path from "lib/Path"; + +function AuthProcess() { + const { userInfo } = useGetUserInfo(); + if (!userInfo) return null; + const { gender, yearOfBirth, mbti } = userInfo!; + const router = useRouter(); + if (!(gender && yearOfBirth && mbti)) router.replace(Path.REGISTER_PAGE); + + return <>; +} + +export default AuthProcess;