Use tuple return values in users and groups model

This commit is contained in:
Johannes Zellner
2025-02-11 15:31:47 +01:00
parent 7322006455
commit dde6e0859b
4 changed files with 18 additions and 18 deletions
+2 -7
View File
@@ -6,7 +6,6 @@ function create() {
const origin = import.meta.env.VITE_API_ORIGIN || window.location.origin;
return {
name: 'GroupsModel',
async list() {
let error, result;
try {
@@ -15,12 +14,8 @@ function create() {
error = e;
}
if (error || result.status !== 200) {
console.error('Failed to list groups.', error || result.status);
return [];
}
return result.body.groups;
if (error || result.status !== 200) return [error || result];
return [null, result.body.groups];
},
};
}