From 0a71b3dac8a93a9c8a69a50e291841b253de7565 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Mon, 21 Dec 2020 18:46:01 +0000 Subject: [PATCH] Remove legacy url if one was parsed --- src/App.vue | 12 ++++++++++++ src/store/state.ts | 1 + 2 files changed, 13 insertions(+) diff --git a/src/App.vue b/src/App.vue index 84e6c5e..b1fa256 100644 --- a/src/App.vue +++ b/src/App.vue @@ -87,6 +87,18 @@ export default defineComponent({ const parsedUrl = Util.parseUrl(); if(parsedUrl) { + //Remove legacy url if one was parsed + if(parsedUrl.legacy) { + const url = new URL(window.location.href); + url.searchParams.delete('worldname'); + url.searchParams.delete('mapname'); + url.searchParams.delete('x'); + url.searchParams.delete('y'); + url.searchParams.delete('z'); + url.searchParams.delete('zoom'); + history.replaceState({}, '', url.toString()); + } + store.commit(MutationTypes.SET_PARSED_URL, parsedUrl); } }; diff --git a/src/store/state.ts b/src/store/state.ts index c12ec80..5173ee6 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -150,5 +150,6 @@ export const state: State = { map: undefined, location: undefined, zoom: undefined, + legacy: false, } };