ui: Display grades works
This commit is contained in:
parent
f3aabf9b63
commit
4f87298f63
5 changed files with 71 additions and 1 deletions
|
|
@ -61,7 +61,7 @@ export async function getUserNeedingHelp() {
|
|||
}
|
||||
|
||||
export async function getScore(survey) {
|
||||
const res = await fetch(`api/surveys/${survey.id}/score`, {headers: {'Accept': 'application/json'}})
|
||||
const res = await fetch(survey.kind === "w" ? `api/works/${survey.id}/score` : `api/surveys/${survey.id}/score`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return await res.json();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,18 @@ export class Work {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getGrades() {
|
||||
const res = await fetch(`api/works/${this.id}/grades`, {
|
||||
method: 'GET',
|
||||
headers: {'Accept': 'application/json'},
|
||||
});
|
||||
if (res.status == 200) {
|
||||
return await res.json();
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getWorks() {
|
||||
|
|
|
|||
Reference in a new issue