diff --git a/apps/admin-x-settings/src/components/settings/growth/Offers.tsx b/apps/admin-x-settings/src/components/settings/growth/Offers.tsx index 4ac3765293..30a1824e78 100644 --- a/apps/admin-x-settings/src/components/settings/growth/Offers.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/Offers.tsx @@ -57,6 +57,7 @@ const Offers: React.FC<{ keywords: string[] }> = ({keywords}) => { }; const goToOfferEdit = (offerId: string) => { + sessionStorage.setItem('editOfferPageSource', 'offers'); updateRoute(`offers/edit/${offerId}`); }; diff --git a/apps/admin-x-settings/src/components/settings/growth/offers/EditOfferModal.tsx b/apps/admin-x-settings/src/components/settings/growth/offers/EditOfferModal.tsx index cbd8317b2c..7f5d9a3d2e 100644 --- a/apps/admin-x-settings/src/components/settings/growth/offers/EditOfferModal.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/offers/EditOfferModal.tsx @@ -269,7 +269,13 @@ const EditOfferModal: React.FC<{id: string}> = ({id}) => { title='Offer' width={1140} onCancel={() => { - updateRoute('offers/edit'); + if (sessionStorage.getItem('editOfferPageSource') === 'offers') { + sessionStorage.removeItem('editOfferPageSource'); + updateRoute('offers'); + } else { + sessionStorage.removeItem('editOfferPageSource'); + updateRoute('offers/edit'); + } }} onOk={async () => { if (!(await handleSave({fakeWhenUnchanged: true}))) { diff --git a/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx b/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx index d90d1b990c..c167a94b35 100644 --- a/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx @@ -126,6 +126,7 @@ export const OffersIndexModal = () => { const handleOfferEdit = (id:string) => { // TODO: implement + sessionStorage.setItem('editOfferPageSource', 'offersIndex'); updateRoute(`offers/edit/${id}`); };