Skip to content

Commit

Permalink
reload the costs page when the time entry is edited
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Dec 20, 2024
1 parent e642111 commit 7cd0b13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ export class TriggerActionsEntryComponent {

editTimeEntry() {
void this.loadEntry().subscribe((entry:TimeEntryResource) => {
// TODO: We need to reload here when the dialog is submitted ... How should we do this?
document.addEventListener('dialog:close', (event:CustomEvent) => {
const { detail: { dialog } } = event as { detail:{ dialog:HTMLDialogElement } };
if (dialog.id === 'time-entry-dialog') {
window.location.reload();
}
});
void this.turboRequestService.request(
this.pathHelper.timeEntryEditDialog(entry.id as string),
{ method: 'GET' },
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/turbo/turbo-event-listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export function addTurboEventListeners() {
const dialog = target.closest('dialog') as HTMLDialogElement;

if (dialog) {
document.dispatchEvent(new CustomEvent('dialog:close', { detail: { dialog } }));

if (dialog.dataset.keepOpenOnSubmit !== 'true') {
dialog.close();
}

document.dispatchEvent(new CustomEvent('dialog:close', { detail: { dialog } }));
}
}
});
Expand Down

0 comments on commit 7cd0b13

Please sign in to comment.