add ability to uninstall an app again
This commit is contained in:
@@ -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];
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user