2021-03-22 21:59:22 +13:00
|
|
|
import { writable } from "svelte/store"
|
2021-03-26 21:50:37 +13:00
|
|
|
import api from "builderStore/api"
|
2021-03-22 21:59:22 +13:00
|
|
|
|
2021-03-26 21:50:37 +13:00
|
|
|
export function createPermissionStore() {
|
2021-03-30 00:16:41 +13:00
|
|
|
const { subscribe } = writable([])
|
2021-03-22 21:59:22 +13:00
|
|
|
|
|
|
|
return {
|
|
|
|
subscribe,
|
|
|
|
forResource: async resourceId => {
|
|
|
|
const response = await api.get(`/api/permission/${resourceId}`)
|
|
|
|
const json = await response.json()
|
|
|
|
return json
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const permissions = createPermissionStore()
|