ilk
This commit is contained in:
31
ui/src/stores/userPermissionStore.js
Normal file
31
ui/src/stores/userPermissionStore.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import api from 'src/services/api'
|
||||
|
||||
export const useUserPermissionStore = defineStore('userPerm', {
|
||||
|
||||
state: () => ({
|
||||
rows: [],
|
||||
loading: false,
|
||||
saving: false
|
||||
}),
|
||||
|
||||
actions: {
|
||||
|
||||
async fetch (id) {
|
||||
this.loading = true
|
||||
|
||||
const res = await api.get(`/users/${id}/permissions`)
|
||||
this.rows = res.data || []
|
||||
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
async save (id) {
|
||||
this.saving = true
|
||||
|
||||
await api.post(`/users/${id}/permissions`, this.rows)
|
||||
|
||||
this.saving = false
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user