Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VueRouter meta evaluation by providing a callback that returns a promise doesn't work as expected #22

Open
ricardo17coelho opened this issue Jul 16, 2024 · 0 comments

Comments

@ricardo17coelho
Copy link

If the "can" rule returns false, no page will be rendered ( empty page )

{
  path: 'posts/:postId',
  component: PostEditor,
  meta: {
    can: (to, from, can) => {        
      return axios.get(`/api/posts/${to.params.id}`)
        .then((response) => can('edit-post', response.data));
    },
    onDeniedRoute: '/unauthorized'
  }
}

This can be easy tested with the playground example here: https://github.com/victorybiz/vue-simple-acl/blob/master/playground/src/main.ts#L30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant