Refactor submission retrieval
This commit is contained in:
parent
24d39dd14e
commit
eacaedeb03
7 changed files with 175 additions and 113 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Reference in a new issue