diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-08-27 18:51:20 +0200 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2022-08-27 18:51:20 +0200 |
| commit | 4bfa34dc950e30650e9525126448bf74dd243096 (patch) | |
| tree | ec7696fa4f3930b96e9a727cf46ec9885093e489 /webAO/utils | |
| parent | 2a79fa570e6e144e4124f3038214f6f49d2acac0 (diff) | |
| parent | 21170e1935e34f36d2fd4268468414e8caf84627 (diff) | |
Merge branch 'master' into newclock
Diffstat (limited to 'webAO/utils')
| -rw-r--r-- | webAO/utils/queryParser.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/webAO/utils/queryParser.ts b/webAO/utils/queryParser.ts new file mode 100644 index 0000000..3110c14 --- /dev/null +++ b/webAO/utils/queryParser.ts @@ -0,0 +1,22 @@ +interface QueryParams { + ip: string; + serverIP: string; + mode: string; + asset: string; + theme: string; +} +interface StringMap { + [key: string]: any; +} + +const queryParser = (): QueryParams => { + const queryDict: StringMap = {}; + location.search + .substr(1) + .split("&") + .forEach((item) => { + queryDict[item.split("=")[0]] = item.split("=")[1]; + }); + return queryDict as QueryParams; +}; +export default queryParser; |
