From a6f80da2534f3f6b1dda0311a83857cebd4d1785 Mon Sep 17 00:00:00 2001 From: limes Date: Tue, 18 Aug 2026 16:24:56 +0200 Subject: [PATCH] feat: add beforeunload listener to miieditor --- src/pages/account/miieditor.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pages/account/miieditor.vue b/src/pages/account/miieditor.vue index e5a71bf..435f9aa 100644 --- a/src/pages/account/miieditor.vue +++ b/src/pages/account/miieditor.vue @@ -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;