question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple guards support

See original GitHub issue

There is any plan to add multiple guards support for Per-Route Guards?

For the cases where have multiple resolves before access to the route. for example check if user connected, next check if user is active, next check if resource is available… All before go into route.

maybe passing an array of functions to beforeEach and going to the view after the last next. something like

{ 
    path: '/hello', 
    component: Hello, 
    beforeEach: [function(from, to, next){
      // first check
      // ...
      next() // goes to seccond check
    }, function(from, to, next){
      // seccond check
      // ...
      next() // If last check -> goes to component Hello
    }] 
  }

Would be great

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:32 (8 by maintainers)

github_iconTop GitHub Comments

28reactions
atanas-devcommented, Sep 9, 2017

If anyone is interested, I just published my implementation of multiple guards: https://www.npmjs.com/package/vue-router-multiguard

To use it you just have to pass your guards array as an argument to multiguard like this:

beforeEnter: multiguard([guard1, guard2])
15reactions
nathanycommented, Sep 27, 2018

@posva please consider reopening this issue so it doesn’t get lost.

use case here is: beforeEnter: [requireAuth, anotherGuard]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using multiple guards | laravel-permission - Spatie
##Using permissions and roles with multiple guards. When creating new permissions and roles, if no guard is specified, then the first defined guard...
Read more >
How to use multiple authentication guards in a Laravel app
This tutorial guides you through setting up multiple authentication guard in a Laravel web app. You will provide multiple authentication ...
Read more >
Implement Multiple Authentication Guards in Laravel 8
Learn How to Implement Multiple Authentication Guards in Laravel 8 in this step-by-step guide by using separate login and table.
Read more >
How to Implement Multiple Authentication Guards in Laravel 9
How to Implement Multiple Authentication Guards in Laravel 9 · Step 1: Install Laravel Project · Step 2: Install Laravel UI · Step...
Read more >
Multiple canActivate guards all run when first fails
First of all, angular doesn't support the feature to call the guards in tandem. So if first guard is asynchronous and is trying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found