Mock repository update

This commit is contained in:
nemunaire 2022-09-04 23:54:10 +02:00
commit 8d9245f1b1
3 changed files with 33 additions and 3 deletions

View file

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