🚑 Fix issue with new api addon shema #160

This commit is contained in:
SebClem 2022-07-12 22:30:27 +02:00
parent 9de8584a5e
commit a3f92e4744
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -61,18 +61,12 @@ function getAddonList() {
statusTools.setStatus(status); statusTools.setStatus(status);
} }
let addons = result.body.data.addons; let addons = result.body.data.addons;
let installed = []; addons.sort((a, b) => {
for (let current of addons) {
if (current.installed === true) {
installed.push({ slug: current.slug, name: current.name })
}
}
installed.sort((a, b) => {
let textA = a.name.toUpperCase(); let textA = a.name.toUpperCase();
let textB = b.name.toUpperCase(); let textB = b.name.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0; return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
}); });
resolve(installed); resolve(addons);
}) })
.catch((error) => { .catch((error) => {
statusTools.setError(`Fail to fetch addons list (${error.message})`, 1); statusTools.setError(`Fail to fetch addons list (${error.message})`, 1);