chore: prep release
This commit is contained in:
@@ -23,7 +23,8 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
},
|
},
|
||||||
async setup(options, nuxt) {
|
async setup(options, nuxt) {
|
||||||
const resolver = createResolver(import.meta.url)
|
const resolver = createResolver(import.meta.url)
|
||||||
const permissions = options.permissions ?? {}
|
/* eslint-disable-next-line */
|
||||||
|
const permissions = options.permissions ?? {} as any
|
||||||
const canFunctionImport = options.canFunctionImport ?? DEFAULT_CAN_FUNCTION_IMPORT
|
const canFunctionImport = options.canFunctionImport ?? DEFAULT_CAN_FUNCTION_IMPORT
|
||||||
const reporter = options.reporter ?? false
|
const reporter = options.reporter ?? false
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ type NuxtCanChecker = (path: string[]) => boolean | Promise<boolean>
|
|||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
const runtimeConfig = useRuntimeConfig()
|
const runtimeConfig = useRuntimeConfig()
|
||||||
const moduleConfig = (runtimeConfig.public as { nuxtCan?: NuxtCanRuntimeConfig }).nuxtCan
|
const moduleConfig = (runtimeConfig.public as { nuxtCan?: NuxtCanRuntimeConfig }).nuxtCan
|
||||||
const canProxy = createCanProxy()
|
/* eslint-disable-next-line */
|
||||||
|
const canProxy = createCanProxy() as any
|
||||||
const canFunction = hostCan as NuxtCanChecker
|
const canFunction = hostCan as NuxtCanChecker
|
||||||
|
|
||||||
if (import.meta.dev && !moduleConfig?.canFunctionImport) {
|
if (import.meta.dev && !moduleConfig?.canFunctionImport) {
|
||||||
|
|||||||
23
test/fixtures/basic/app.vue
vendored
23
test/fixtures/basic/app.vue
vendored
@@ -5,7 +5,7 @@
|
|||||||
<section>
|
<section>
|
||||||
<button
|
<button
|
||||||
id="can-view"
|
id="can-view"
|
||||||
v-can="canProxy.employee.view"
|
v-can="can.employee.view"
|
||||||
>
|
>
|
||||||
Voir
|
Voir
|
||||||
</button>
|
</button>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<button
|
<button
|
||||||
v-if="isReady"
|
v-if="isReady"
|
||||||
id="can-edit"
|
id="can-edit"
|
||||||
v-can="canProxy.employee.edit"
|
v-can="can.employee.edit"
|
||||||
>
|
>
|
||||||
Editer
|
Editer
|
||||||
</button>
|
</button>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<template v-if="showContracts">
|
<template v-if="showContracts">
|
||||||
<p v-can="canProxy.contract.create">
|
<p v-can="can.contract.create">
|
||||||
Creation contrat
|
Creation contrat
|
||||||
</p>
|
</p>
|
||||||
<p v-cannot>
|
<p v-cannot>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<h2>Suppression</h2>
|
<h2>Suppression</h2>
|
||||||
<button
|
<button
|
||||||
id="can-delete"
|
id="can-delete"
|
||||||
v-can="canProxy.employee.delete"
|
v-can="can.employee.delete"
|
||||||
>
|
>
|
||||||
Supprimer
|
Supprimer
|
||||||
</button>
|
</button>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
<section>
|
<section>
|
||||||
<p id="path-display">
|
<p id="path-display">
|
||||||
{{ String(canProxy.employee.view) }}
|
{{ String(can.employee.view) }}
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
@@ -66,17 +66,4 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const isReady = true
|
const isReady = true
|
||||||
const showContracts = true
|
const showContracts = true
|
||||||
interface FixturePermissions {
|
|
||||||
employee: {
|
|
||||||
view: boolean
|
|
||||||
edit: boolean
|
|
||||||
delete: boolean
|
|
||||||
}
|
|
||||||
contract: {
|
|
||||||
create: boolean
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const nuxtApp = useNuxtApp()
|
|
||||||
const canProxy = nuxtApp.$can as unknown as FixturePermissions
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user