diff --git a/src/pages/Event.tsx b/src/pages/Event.tsx index a1544ab..a83f645 100644 --- a/src/pages/Event.tsx +++ b/src/pages/Event.tsx @@ -7,6 +7,7 @@ import { IOrderState } from 'src/store/types'; import { Button, Result } from 'antd'; const mapState = (state: IOrderState) => ({ + eventId: state.eventId, eventInfo: state.event, shopInfo: state.shop, }); @@ -21,13 +22,13 @@ type EventProps = RouteComponentProps<{eventId: string}> & ConnectedProps; const Event: React.FC = ({ - eventInfo, shopInfo, match, setEvent, + eventId, eventInfo, shopInfo, match, setEvent, }) => { - const { eventId } = match.params; - useEffect(() => { - setEvent(eventId); - }, [eventId, setEvent]); + if (eventId !== match.params.eventId) { + setEvent(match.params.eventId); + } + }, [match.params.eventId, setEvent]); if (!eventInfo.loading && !shopInfo.loading && shopInfo === null) { return ( @@ -44,7 +45,7 @@ const Event: React.FC = ({
{!eventInfo.loading && eventInfo.data?.title}
{/* {!!event?.closed && 본 주문은 마감되었습니다} */}