Edit cancle button fix (#19350)
Fixes: [PROD-213](https://linear.app/tryghost/issue/PROD-213/cancelling-should-act-two-ways-when-the-modal-is-opened-from-the-list)
This commit is contained in:
parent
b7648e7bc2
commit
830967d2ed
@ -57,6 +57,7 @@ const Offers: React.FC<{ keywords: string[] }> = ({keywords}) => {
|
||||
};
|
||||
|
||||
const goToOfferEdit = (offerId: string) => {
|
||||
sessionStorage.setItem('editOfferPageSource', 'offers');
|
||||
updateRoute(`offers/edit/${offerId}`);
|
||||
};
|
||||
|
||||
|
@ -269,7 +269,13 @@ const EditOfferModal: React.FC<{id: string}> = ({id}) => {
|
||||
title='Offer'
|
||||
width={1140}
|
||||
onCancel={() => {
|
||||
if (sessionStorage.getItem('editOfferPageSource') === 'offers') {
|
||||
sessionStorage.removeItem('editOfferPageSource');
|
||||
updateRoute('offers');
|
||||
} else {
|
||||
sessionStorage.removeItem('editOfferPageSource');
|
||||
updateRoute('offers/edit');
|
||||
}
|
||||
}}
|
||||
onOk={async () => {
|
||||
if (!(await handleSave({fakeWhenUnchanged: true}))) {
|
||||
|
@ -126,6 +126,7 @@ export const OffersIndexModal = () => {
|
||||
|
||||
const handleOfferEdit = (id:string) => {
|
||||
// TODO: implement
|
||||
sessionStorage.setItem('editOfferPageSource', 'offersIndex');
|
||||
updateRoute(`offers/edit/${id}`);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user