diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-08-26 18:33:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 18:33:14 +0200 |
| commit | cee8506e1385bb728b7f0eb762e35401bd875fdc (patch) | |
| tree | e5137d75c3c886b620f7f5659cac7f9438f51a23 /webAO/utils/queryParser.ts | |
| parent | a6186ff308c844b39d71cfd65e3d3117dbdbedb0 (diff) | |
| parent | a96a2b8c914e55f12d49b1287b445f89d32926ea (diff) | |
Merge pull request #154 from caleb-mabry/stuff
Move HandleMS out of Client
Diffstat (limited to 'webAO/utils/queryParser.ts')
| -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; |
