Lots of bug fixes. Lots of clean up. Things work more consitently.
This commit is contained in:
@@ -36,19 +36,15 @@ const modal_edit__sponsorship_obj: ModalSettings = {
|
||||
response: (r: boolean | undefined) => handle_modal_close(r)
|
||||
};
|
||||
|
||||
|
||||
// This should be merged with the ae_util.handle_url_and_message() function.
|
||||
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
|
||||
function handle_modal_close(response: boolean | undefined) {
|
||||
console.log('Modal closed. Response:', response);
|
||||
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('sponsorship_id');
|
||||
history.pushState({}, '', url);
|
||||
ae_util.handle_url_and_message('sponsorship_id', null);
|
||||
|
||||
let message = {'sponsorship_id': null};
|
||||
window.parent.postMessage(message, "*");
|
||||
// console.log('Message sent to parent (iframe):', message);
|
||||
// We want to keep these values in case they want to re-open the modal. Do NOT clear.
|
||||
// $slct.sponsorship_id = null;
|
||||
// $slct.sponsorship_obj = null;
|
||||
}
|
||||
|
||||
if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) {
|
||||
@@ -80,16 +76,12 @@ onMount(() => {
|
||||
$ae_loc.href_url = url;
|
||||
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
|
||||
|
||||
$slct_trigger = null;
|
||||
|
||||
ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
|
||||
if ($slct.sponsorship_id) {
|
||||
console.log(`Got an ID. Let's show the modal!`);
|
||||
|
||||
// handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
|
||||
modalStore.trigger(modal_edit__sponsorship_obj);
|
||||
} else {
|
||||
// handle_url_and_message('sponsorship_id', null);
|
||||
console.log(`No ID. Nothing to show.`);
|
||||
}
|
||||
});
|
||||
// console.log(`$ae_loc = `, $ae_loc);
|
||||
|
||||
Reference in New Issue
Block a user