diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-11-17 23:29:17 +0100 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2022-11-17 23:29:17 +0100 |
| commit | 14dd6bf87f05a411b4eadcb4f6f37f726341a800 (patch) | |
| tree | 062dbd7cfc04ad3a012f10418ba408ebf76f94f2 | |
| parent | 2b78887579ba24355936ae75f912c55343bf0d0b (diff) | |
still have custom if request fails
| -rw-r--r-- | webAO/client/fetchLists.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/webAO/client/fetchLists.ts b/webAO/client/fetchLists.ts index bf4fd1b..704c889 100644 --- a/webAO/client/fetchLists.ts +++ b/webAO/client/fetchLists.ts @@ -21,10 +21,6 @@ export const fetchBackgroundList = async () => { export const fetchCharacterList = async () => { try { - const chardata = await request(`${AO_HOST}characters.json`); - const char_array = JSON.parse(chardata); - // the try catch will fail before here when there is no file - const char_select = <HTMLSelectElement>( document.getElementById("client_iniselect") ); @@ -32,6 +28,10 @@ export const fetchCharacterList = async () => { char_select.add(new Option("Custom", "0")); + const chardata = await request(`${AO_HOST}characters.json`); + const char_array = JSON.parse(chardata); + // the try catch will fail before here when there is no file + char_array.forEach((character: string) => { char_select.add(new Option(character)); }); @@ -43,10 +43,6 @@ export const fetchCharacterList = async () => { export const fetchEvidenceList = async () => { try { - const evidata = await request(`${AO_HOST}evidence.json`); - const evi_array = JSON.parse(evidata); - // the try catch will fail before here when there is no file - const evi_select = <HTMLSelectElement>( document.getElementById("evi_select") ); @@ -54,6 +50,10 @@ export const fetchEvidenceList = async () => { evi_select.add(new Option("Custom", "0")); + const evidata = await request(`${AO_HOST}evidence.json`); + const evi_array = JSON.parse(evidata); + // the try catch will fail before here when there is no file + evi_array.forEach((evi: string) => { evi_select.add(new Option(evi)); }); |
