[api][fix] fixed setting roles

This commit is contained in:
Tim Gröger 2021-11-19 23:10:28 +01:00
parent 3e091fd02b
commit dad88ec766
1 changed files with 9 additions and 1 deletions

View File

@ -91,7 +91,15 @@ export const useUserStore = defineStore({
}, },
async updateRole(role: FG.Role) { async updateRole(role: FG.Role) {
await api.put(`/roles/${role.id}`, role); try {
await api.put(`/roles/${role.id}`, role);
} catch (error) {
console.warn(error);
}
this._updatePermission(role);
},
_updatePermission(role: FG.Role) {
const idx = this.roles.findIndex((r) => r.id === role.id); const idx = this.roles.findIndex((r) => r.id === role.id);
if (idx != -1) this.roles[idx] = role; if (idx != -1) this.roles[idx] = role;
this._dirty_roles = true; this._dirty_roles = true;