diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-08-25 21:34:08 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-08-25 21:34:08 -0400 |
| commit | 9bec7d0fba8c80284e260469ed3045e9dfdb5d79 (patch) | |
| tree | bf0593251955f960412ba9561c23a9b5b5465421 /webAO/utils | |
| parent | a6186ff308c844b39d71cfd65e3d3117dbdbedb0 (diff) | |
Remove handleMS and separate queryParser
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; |
