Skip to content

Commit

Permalink
Add referer
Browse files Browse the repository at this point in the history
  • Loading branch information
predict-woo committed Feb 22, 2024
1 parent 1cff0e0 commit 38a337e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/web/src/components/Skeleton/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
24 changes: 23 additions & 1 deletion packages/web/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
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";

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 (
<>
<InfoSection />
Expand All @@ -25,6 +46,7 @@ const Home = () => {
isOpen={_roomId === "privacyPolicy"}
onChangeIsOpen={onChangeIsOpenPrivacyPolicy}
/>
{/* 모달 완성되면 넣을 곳 */}
</>
);
};
Expand Down

0 comments on commit 38a337e

Please sign in to comment.