add ability to uninstall an app again

This commit is contained in:
Johannes Zellner
2025-02-21 14:07:07 +01:00
parent 6a5de6606c
commit e4c47de90a
3 changed files with 64 additions and 17 deletions
+18
View File
@@ -87,6 +87,13 @@ function create() {
return {
name: 'AppsModel',
getTask,
isStopped(app) {
if (app.installationState === ISTATES.PENDING_START || app.installationState === ISTATES.PENDING_STOP) {
return app.installationState === ISTATES.PENDING_START;
} else {
return app.runState === RSTATES.STOPPED;
}
},
async install(manifest, config) {
const data = {
appStoreId: manifest.id + '@' + manifest.version,
@@ -224,6 +231,17 @@ function create() {
if (result.status !== 200 && result.status !== 202) return [result];
return [null];
},
async uninstall(id) {
let result;
try {
result = await fetcher.post(`${origin}/api/v1/apps/${id}/uninstall`, {}, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 202) return [result];
return [null];
},
};
}