diff --git a/packages/web/src/components/Skeleton/Routes.tsx b/packages/web/src/components/Skeleton/Routes.tsx index 276b1ce66..4b74a3ab8 100644 --- a/packages/web/src/components/Skeleton/Routes.tsx +++ b/packages/web/src/components/Skeleton/Routes.tsx @@ -27,6 +27,11 @@ const routeProps = [ component: lazy(() => import("@/pages/Home")), exact: true, }, + { + path: "/event/2024spring-invite/:eventStatusId", + component: lazy(() => import("@/pages/Home")), + exact: true, + }, { path: "/event/:eventName", component: lazy(() => import("@/pages/Event")), diff --git a/packages/web/src/pages/Home/index.tsx b/packages/web/src/pages/Home/index.tsx index ee5205152..6e5000097 100644 --- a/packages/web/src/pages/Home/index.tsx +++ b/packages/web/src/pages/Home/index.tsx @@ -1,5 +1,8 @@ +import { useEffect } from "react"; import { useHistory, useParams } from "react-router-dom"; +import useQuery from "@/hooks/useTaxiAPI"; + import Footer from "@/components/Footer"; import { ModalPrivacyPolicy } from "@/components/ModalPopup"; @@ -7,13 +10,31 @@ import EventSection from "./EventSection"; import InfoSection from "./InfoSection"; import RoomSection from "./RoomSection"; +import { getDynamicLink } from "@/tools/trans"; + const Home = () => { const history = useHistory(); - const { roomId: _roomId } = useParams<{ roomId: string }>(); + const { roomId: _roomId, eventStatusId: eventStatusId } = useParams<{ + roomId: string; + eventStatusId: string; + }>(); const roomId = _roomId === "privacyPolicy" ? null : _roomId; + const [, eventProfile] = useQuery.get( + `/events/2024spring/invite/search/:${roomId}`, + {}, + [eventStatusId] + ); + const onChangeIsOpenPrivacyPolicy = () => history.replace("/home"); + useEffect(() => { + if (!eventStatusId) return; + const dynamicLink = getDynamicLink(window.location.pathname); + window.location.replace(dynamicLink); + + }, [eventStatusId]); + return ( <> @@ -25,6 +46,7 @@ const Home = () => { isOpen={_roomId === "privacyPolicy"} onChangeIsOpen={onChangeIsOpenPrivacyPolicy} /> + {/* 모달 완성되면 넣을 곳 */} ); };