feat: add beforeunload listener to miieditor

This commit is contained in:
limes
2026-08-18 16:24:56 +02:00
parent 783d29f86c
commit a6f80da253

View File

@@ -19,7 +19,19 @@ useHead({
title: 'Mii Editor | Pretendo Network'
});
// TODO: literally all the backend stuff
const beforeUnload = (e: BeforeUnloadEvent) => {
e?.preventDefault();
e.returnValue = '';
};
onMounted(() => {
window.addEventListener('beforeunload', beforeUnload);
});
onBeforeUnmount(() => {
window.removeEventListener('beforeunload', beforeUnload);
});
const fallbackMiiData =
'AwAAQOlVognnx0GC2qjhdwOzuI0n2QAAAGBzAHQAZQB2AGUAAAAAAAAAAAAAAEBAAAAhAQJoRBgmNEYUgRIXaA0AACkAUkhQAAAAAAAAAAAAAAAAAAAAAAAAAAAAANeC';
const miiDataString: string = profile.value?.mii?.data || fallbackMiiData;