Implement app update view

This commit is contained in:
Johannes Zellner
2025-02-21 20:58:43 +01:00
parent d77aaded39
commit 7d35c9a8eb
4 changed files with 161 additions and 1 deletions
+27
View File
@@ -253,6 +253,33 @@ function create() {
if (result.status !== 200) return [result];
return [null, result.body.eventlogs];
},
async checkForUpdates(id) {
let result;
try {
result = await fetcher.post(`${origin}/api/v1/apps/${id}/check_for_updates`, {}, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 200) return [result];
return [null, result.body.update];
},
async update(id, manifest, skipBackup = false) {
const data = {
appStoreId: `${manifest.id}@${manifest.version}`,
skipBackup: !!skipBackup,
};
let result;
try {
result = await fetcher.post(`${origin}/api/v1/apps/${id}/update`, data, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 202) return [result];
return [null];
},
};
}