Skip to content

Commit

Permalink
Close modals after navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
hulloitskai committed Jan 1, 2025
1 parent c4e67b0 commit f620223
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/helpers/inertia/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { router } from "@inertiajs/core";
import { closeAllModals } from "@mantine/modals";

export const setupInertia = (): void => {
router.on("before", ({ detail: { visit } }) => {
Expand All @@ -7,4 +8,7 @@ export const setupInertia = (): void => {
visit.headers["X-CSRF-Token"] = csrfToken;
}
});
router.on("navigate", () => {
closeAllModals();
});
};

0 comments on commit f620223

Please sign in to comment.