diff options
author | Luca Matei Pintilie <lucafulger@gmail.com> | 2021-11-28 19:01:49 +0000 |
---|---|---|
committer | Luca Matei Pintilie <lucafulger@gmail.com> | 2021-11-28 19:01:49 +0000 |
commit | 5a137ce1370dd1dd49a45fff739a2e6c8f259ef5 (patch) | |
tree | d0f30345b1c168b684ec01006566f8455b109eb8 | |
parent | 6c29c2c134f069f247e3a9cd7a361405d38b159f (diff) | |
download | speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar.gz speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar.bz2 speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar.lz speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar.xz speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.tar.zst speedrunbot-slash-5a137ce1370dd1dd49a45fff739a2e6c8f259ef5.zip |
If an option is empty then don't return anything
-rwxr-xr-x | src/srcom/utils.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/srcom/utils.ts b/src/srcom/utils.ts index c4dd843..a3cc8fe 100755 --- a/src/srcom/utils.ts +++ b/src/srcom/utils.ts @@ -24,6 +24,7 @@ interface ApiArrayResponse { export async function getUser( query: string, ): Promise<SpeedrunCom.User | false> { + if (!query.length) return false; let res: Response; res = await fetch(`${SRC_API}/users?lookup=${encodeURI(query)}`); const data = (await res.json()).data as SpeedrunCom.User[]; @@ -38,6 +39,7 @@ export async function getUser( export async function getGame( query: string, ): Promise<SpeedrunCom.Game | false> { + if (!query.length) return false; let res: Response; res = await fetch(`${SRC_API}/games?abbreviation=${query}`); const data = (await res.json()).data as SpeedrunCom.Game[]; |