Implement app start/stop and add app state polling for the moment
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user