mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-04-10 06:55:35 -04:00
chore: Nuxt 4 upgrade (#7426)
This commit is contained in:
20
frontend/app/composables/use-navigation-warning.ts
Normal file
20
frontend/app/composables/use-navigation-warning.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export function useNavigationWarning() {
|
||||
return { activateNavigationWarning, deactivateNavigationWarning };
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a warning before the user navigates to another page
|
||||
* e.g., by clicking a link (which isn't internal and rendered without page load),
|
||||
* reloading the page,
|
||||
* or closing the tab.
|
||||
*/
|
||||
const activateNavigationWarning = () => {
|
||||
window.onbeforeunload = () => true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disables the warning when navigating to a page
|
||||
*/
|
||||
const deactivateNavigationWarning = () => {
|
||||
window.onbeforeunload = null;
|
||||
};
|
||||
Reference in New Issue
Block a user