Refactor submission retrieval

This commit is contained in:
nemunaire 2022-09-05 04:40:49 +02:00
commit eacaedeb03
7 changed files with 175 additions and 113 deletions

View file

@ -36,17 +36,6 @@ export class WorkRepository {
}
}
async getSubmission() {
const res = await fetch(`api/repositories/${this.id}/submission`, {
headers: {'Accept': 'application/json'}
});
if (res.status == 200) {
return await res.json();
} else {
throw new Error((await res.json()).errmsg);
}
}
async retrieveWork() {
const res = await fetch(`api/repositories/${this.id}/trigger`, {
method: 'POST',

View file

@ -91,6 +91,17 @@ export class Work {
}
}
async getSubmission() {
const res = await fetch(`api/works/${this.id}/submission`, {
headers: {'Accept': 'application/json'}
});
if (res.status == 200) {
return await res.json();
} else {
throw new Error((await res.json()).errmsg);
}
}
async getGrades() {
const res = await fetch(`api/works/${this.id}/grades`, {
method: 'GET',