Made the closing of the modals cleaner
This commit is contained in:
@@ -34,6 +34,8 @@ const modal_edit__event_presenter_obj: ModalSettings = {
|
||||
component: modalComponentEditEventPresenterObj,
|
||||
title: 'Edit Event Presenter',
|
||||
position: '', // default is "items-center"
|
||||
|
||||
response: (r: boolean | undefined) => handle_modal_close(r)
|
||||
};
|
||||
|
||||
// Viewing
|
||||
@@ -55,8 +57,19 @@ const modal_view__event_presenter_obj: ModalSettings = {
|
||||
// component_root_classes: 'w-full',
|
||||
// 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.events.show_edit__event_presenter_obj = false;
|
||||
$ae_loc.mod.sponsorships.show_view__event_presenter_obj = false;
|
||||
|
||||
@@ -125,15 +125,7 @@ onMount(() => {
|
||||
{/if}
|
||||
<button
|
||||
class="btn {parent.buttonNeutral}"
|
||||
on:click={() => {
|
||||
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_presenter_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
parent.onClose();
|
||||
}}
|
||||
on:click={() => {parent.onClose();}}
|
||||
>
|
||||
{parent.buttonTextCancel}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user