Made the closing of the modals cleaner
This commit is contained in:
@@ -36,12 +36,7 @@ const modal_edit__sponsorship_obj: ModalSettings = {
|
||||
title: 'Edit Sponsorship',
|
||||
position: '', // default is "items-center"
|
||||
|
||||
// Provide arbitrary classes to the backdrop and modal elements:
|
||||
// backdropClasses: '!bg-green-500',
|
||||
// modalClasses: 'w-modal-wide',
|
||||
|
||||
// Provide arbitrary metadata to your modal instance:
|
||||
// meta: { fn: do_something_function }
|
||||
response: (r: boolean | undefined) => handle_modal_close(r)
|
||||
};
|
||||
|
||||
// Viewing
|
||||
@@ -59,8 +54,19 @@ const modal_view__sponsorship_obj: ModalSettings = {
|
||||
|
||||
// Provide arbitrary metadata to your modal instance:
|
||||
// meta: { fn: do_something_function }
|
||||
|
||||
response: (r: boolean | undefined) => handle_modal_close(r)
|
||||
};
|
||||
|
||||
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('event_presenter_id');
|
||||
history.pushState({}, '', url);
|
||||
}
|
||||
|
||||
// We don't want the edit or view to show up by default. Maybe if we see an object ID param in the URL, we can show the view modal.
|
||||
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false;
|
||||
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
|
||||
|
||||
Reference in New Issue
Block a user