[api][fix] fixed setting roles
This commit is contained in:
parent
3e091fd02b
commit
dad88ec766
|
@ -91,7 +91,15 @@ export const useUserStore = defineStore({
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateRole(role: FG.Role) {
|
async updateRole(role: FG.Role) {
|
||||||
|
try {
|
||||||
await api.put(`/roles/${role.id}`, role);
|
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;
|
||||||
|
|
Loading…
Reference in New Issue