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

Hooks should act as a middleware #10

Closed
kewah opened this issue Dec 10, 2014 · 1 comment
Closed

Hooks should act as a middleware #10

kewah opened this issue Dec 10, 2014 · 1 comment

Comments

@kewah
Copy link
Contributor

kewah commented Dec 10, 2014

Currently it's not possible to stop the routing with the hook beforeUpdate. Even if we call Vue.navigate the routing will continue (this.update() is fired) before to change the route.

If would be good to be able to manage beforeUpdate as a middleware (we can directly use pagejs's middleware functionality) to be able to cancel a route if necessary.

'/url': {
      componentId: 'my-view',
      beforeUpdate: function(params, next) {
        if (!user.connected) {
          Vue.navigate('/login')
          return;
        }

        next();
      }
    }

For hook events, next callback should not be passed. They should not interfere with the routing.

ayamflow added a commit that referenced this issue Dec 10, 2014
…with next(). Events emitted with $emit/$broadcast are thus totally async.

Fix #10.
@ayamflow
Copy link
Owner

This is now default behavior in 1.4.0. As a result, the events emitted by the directive are now async (not running in sync with the middleware).

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

2 participants