I created middleware to use in some pages, but im checking and taking time to run

what cand i do fot this?
export default defineNuxtRouteMiddleware(async (to, from) => {
if (!process.server) {
console.log("middleware from client side");
}
}
export default defineNuxtRouteMiddleware(async (to, from) => {
if (!process.server) {
console.log("middleware from client side");
}
}
2 Replies
formigueiro
formigueiroOP3mo ago
I'm trying to deny users access to certain routes, but he gets to see the content until it loads, I don't know on the client or server
less
less3mo ago
Hi, you can just add on the routeRules to specify the page that you want to apply the middleware like this
routeRules: {
"/": {
appMiddleware: ["auth"],
},
},
routeRules: {
"/": {
appMiddleware: ["auth"],
},
},
and just abort the navigation in your middleware, or you can just add 1 by 1 on the pageMeta in every page you want to apply
Want results from more Discord servers?
Add your server