diff --git a/components/Blocks/DynamicContent/Rewards/Surprises/index.tsx b/components/Blocks/DynamicContent/Rewards/Surprises/index.tsx index d0317236a..86d1ab2c5 100644 --- a/components/Blocks/DynamicContent/Rewards/Surprises/index.tsx +++ b/components/Blocks/DynamicContent/Rewards/Surprises/index.tsx @@ -1,5 +1,6 @@ "use client" +import { usePathname } from "next/navigation" import React, { useState } from "react" import { Dialog, Modal, ModalOverlay } from "react-aria-components" import { useIntl } from "react-intl" @@ -27,6 +28,7 @@ export default function Surprises({ membershipNumber, }: SurprisesProps) { const lang = useLang() + const pathname = usePathname() const [open, setOpen] = useState(true) const [selectedSurprise, setSelectedSurprise] = useState(0) const [showSurprises, setShowSurprises] = useState(false) @@ -49,19 +51,22 @@ export default function Surprises({ function closeModal(close: VoidFunction) { viewRewards() - toast.success( - <> - {intl.formatMessage( - { id: "Gift(s) added to your benefits" }, - { amount: surprises.length } - )} -
- - {intl.formatMessage({ id: "Go to My Benefits" })} - - - ) close() + + if (pathname.indexOf(benefits[lang]) !== 0) { + toast.success( + <> + {intl.formatMessage( + { id: "Gift(s) added to your benefits" }, + { amount: surprises.length } + )} +
+ + {intl.formatMessage({ id: "Go to My Benefits" })} + + + ) + } } const surprise = surprises[selectedSurprise]