[Vuejs]-How to use casl-vue in nuxt without refreshing page

0👍

export default function ({ $auth }) {
  const isLogin = $auth.loggedIn
  const abilities = defineAbility((can) => {
    if (isLogin) {
      const user = $auth.user
      can(user.permissions)
    } else {
      can([])
    }
  })

  Vue.use(abilitiesPlugin, abilities)
}

Leave a comment