mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-04 12:34:53 +08:00
showing error when fetch failed
This commit is contained in:
parent
178b6ae83d
commit
4c1175e698
1 changed files with 13 additions and 0 deletions
|
@ -228,6 +228,19 @@ window.onload = async () => {
|
|||
dataResponse.json(),
|
||||
]);
|
||||
|
||||
if (schemaResponse.status !== 200 || dataResponse.status !== 200) {
|
||||
const root = document.querySelector("#root");
|
||||
let html = "";
|
||||
if (schemaResponse.status !== 200) {
|
||||
html += `<i class="unknown-input">Error fetching configuration schema: ${schemaResponseJson.message}</i>`;
|
||||
}
|
||||
if (dataResponse.status !== 200) {
|
||||
html += `<i class="unknown-input">Error fetching configuration data: ${dataResponseJson.message}</i>`;
|
||||
}
|
||||
root.innerHTML = html;
|
||||
return;
|
||||
}
|
||||
|
||||
const { data: formSchema } = schemaResponseJson;
|
||||
const { data: initialData } = dataResponseJson;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue