You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's be very nice to have an option to use the loggedIn middleware as a global middleware.
Current Situation
Currently the middleware needs to be added to each page individually or you need to create your own global middleware.
Creating your own global middleware either means copy / pasting the code from the module or importing directly from node_modules, because the middleware is not exposed so it could be directly imported.
Possible Implementations
I see two options to achieve the desired outcome:
Add a configuration option that adds a global middleware
Expose the middleware functions so they can be imported in a simple and typesafe way
Current workaround
My current implementation / workaround looks like this:
/* * middleware/01-loggedIn.global.ts */importhankoLoggedInfrom"../node_modules/@nuxtjs/hanko/dist/runtime/middleware/logged-in";exportdefaultdefineNuxtRouteMiddleware(async(to,from)=>{// Don't trigger on same page navigation (changes to query or hash)if(process.server||to.path!==from.path){constloggedInCheck=awaithankoLoggedIn(to,from);if(loggedInCheck)returnloggedInCheck;}});
The text was updated successfully, but these errors were encountered:
Desired Behaviour
It's be very nice to have an option to use the loggedIn middleware as a global middleware.
Current Situation
Currently the middleware needs to be added to each page individually or you need to create your own global middleware.
Creating your own global middleware either means copy / pasting the code from the module or importing directly from node_modules, because the middleware is not exposed so it could be directly imported.
Possible Implementations
I see two options to achieve the desired outcome:
Current workaround
My current implementation / workaround looks like this:
The text was updated successfully, but these errors were encountered: