Implement app start/stop and add app state polling for the moment

This commit is contained in:
Johannes Zellner
2025-02-21 12:20:23 +01:00
parent 8132920ed8
commit 6a5de6606c
4 changed files with 78 additions and 23 deletions
+24
View File
@@ -189,6 +189,30 @@ function create() {
await sleep(2000);
}
},
async start(id) {
let result;
try {
result = await fetcher.post(`${origin}/api/v1/apps/${id}/start`, {}, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 202) return [result];
return [null, result.body.taskId];
},
async stop(id) {
let result;
try {
result = await fetcher.post(`${origin}/api/v1/apps/${id}/stop`, {}, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 202) return [result];
return [null, result.body.taskId];
},
async configure(id, setting, data) {
let result;
try {