Remove legacy url if one was parsed

This commit is contained in:
James Lyne 2020-12-21 18:46:01 +00:00
parent 614f0b9774
commit 0a71b3dac8
2 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,18 @@ export default defineComponent({
const parsedUrl = Util.parseUrl(); const parsedUrl = Util.parseUrl();
if(parsedUrl) { 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); store.commit(MutationTypes.SET_PARSED_URL, parsedUrl);
} }
}; };

View File

@ -150,5 +150,6 @@ export const state: State = {
map: undefined, map: undefined,
location: undefined, location: undefined,
zoom: undefined, zoom: undefined,
legacy: false,
} }
}; };