From 9fe4782fbd54e0fa359b4a647e4b5b268cc50941 Mon Sep 17 00:00:00 2001 From: Hanusiak Piotr Date: Wed, 23 Feb 2022 10:14:09 +0100 Subject: [PATCH] clear hashParams after moving player with moveTo param --- front/src/Phaser/Game/GameScene.ts | 2 ++ front/src/Url/UrlManager.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 0a44cea3..b356f5f0 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1598,6 +1598,8 @@ ${escapedMessage} } }) .catch((reason) => console.warn(reason)); + + urlManager.clearHashParameter(); } catch (err) { console.warn(`Cannot proceed with moveTo command:\n\t-> ${err}`); } diff --git a/front/src/Url/UrlManager.ts b/front/src/Url/UrlManager.ts index cb0e1ed0..e881b167 100644 --- a/front/src/Url/UrlManager.ts +++ b/front/src/Url/UrlManager.ts @@ -58,6 +58,10 @@ class UrlManager { return this.getHashParameters()[name]; } + public clearHashParameter(): void { + window.location.hash = ""; + } + private getHashParameters(): Record { return window.location.hash .substring(1)