ui: Add Accept header to retrieve JSON errors

This commit is contained in:
nemunaire 2021-09-06 13:46:24 +02:00
parent de03863f1b
commit bd8db24997
7 changed files with 11 additions and 5 deletions

View File

@ -43,6 +43,7 @@
"submit/" + exercice.id,
{
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify(responses),
}
)

View File

@ -47,6 +47,7 @@
"openhint/" + exercice.id,
{
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify({ id: hint.id }),
}
)

View File

@ -41,6 +41,7 @@
"wantchoices/" + exercice_id,
{
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify({ id: Number(flag.id) }),
}
)

View File

@ -48,6 +48,7 @@
const response = await fetch('chname', {
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify({newName: newTeamName}),
});

View File

@ -33,7 +33,7 @@
};
}
settings.update(await fetch('settings.json'), cb);
settings.update(await fetch('settings.json', {headers: {'Accept': 'application/json'}}), cb);
}
let refresh_interval_teams = null;
@ -45,7 +45,7 @@
}
refresh_interval_teams = setInterval(refresh_teams, interval);
teamsStore.update(await fetch('teams.json'), cb);
teamsStore.update(await fetch('teams.json', {headers: {'Accept': 'application/json'}}), cb);
}
let refresh_interval_themes = null;
@ -57,7 +57,7 @@
}
refresh_interval_themes = setInterval(refresh_themes, interval);
await themesStore.update(await fetch('themes.json'), cb);
await themesStore.update(await fetch('themes.json', {headers: {'Accept': 'application/json'}}), cb);
}
let refresh_interval_my = null;
@ -69,7 +69,7 @@
}
refresh_interval_my = setInterval(refresh_my, interval);
my.update(await fetch('my.json'), cb);
my.update(await fetch('my.json', {headers: {'Accept': 'application/json'}}), cb);
}
let refresh_interval_issues = null;
@ -81,7 +81,7 @@
}
refresh_interval_issues = setInterval(refresh_issues, interval);
issuesStore.update(await fetch('issues.json'), cb);
issuesStore.update(await fetch('issues.json', {headers: {'Accept': 'application/json'}}), cb);
}
export async function load({ page, fetch, session, context }) {

View File

@ -76,6 +76,7 @@
const response = await fetch('issue', {
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify(issue),
});

View File

@ -68,6 +68,7 @@
const response = await fetch('registration', {
method: "POST",
headers: {'Accept': 'application/json'},
body: JSON.stringify(form),
})