New route to launch action individually

This commit is contained in:
nemunaire 2022-12-08 20:15:00 +01:00
commit 05c87ac7b3
3 changed files with 62 additions and 0 deletions

View file

@ -25,6 +25,18 @@ export class Action {
}
}
async launch() {
const res = await fetch(`api/actions/${this.id}/run`, {
method: 'POST',
headers: {'Accept': 'application/json'}
});
if (res.status == 200) {
return true;
} else {
throw new Error((await res.json()).errmsg);
}
}
toggleEnable() {
this.enabled = !this.enabled;
this.save();