router guard and async
See original GitHub issueIs there a particular way I need to use async functions within the wrap function? I’m trying to check authorisation from my API roughly like this.
'/login': Login,
'/facility': wrap(
Facility,
{},
async (detail) => {
const result = await authQuery()
return await result
}
),
'*': Login,
}
but I’m finding the route loads before the results from the api return.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Angular2 canActivate() calling async function - Stack Overflow
When a navigate to a page that has the guard on it, either authenticated , or not authenticated is printed to the console...
Read more >Angular Async Guard Redirect - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >Async guards should have the option to wait for ... - GitHub
When having multiple async guards (returning promise or observable) for the same path they execute at the same time:.
Read more >Running Angular Guards Synchronously - Upmostly
I had a scenario where I had two route guards. The first was simply to check if the user was logged in via...
Read more >Navigation Guards | Vue Router
Global before guards are called in creation order, whenever a navigation is triggered. Guards may be resolved asynchronously, and the navigation is considered ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Promise and lazy routing are on the roadmap. I encountered same issue while I wanted to implement code splitting.
@Manborough support for async functions in route pre-conditions has been added to 3.0 (WIP branch) and will be released with version 3.0 soon 🚀