Files
bssapp/ui/src/stores/userPermissionStore.js
2026-02-11 17:46:22 +03:00

32 lines
555 B
JavaScript

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
}
}
})