Allow hooks in different directories like you do for layouts #12846
tompahoward
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some hooks that check for authentication on certain paths, like
/app,
and they're working well, but I realised it would be nicer if I could put this inroutes/app/hooks.server.ts
so I don't need to maintain the path-checking logic.Even nicer would be putting it in
routes/(authenticated)/hooks.server.ts
because then we wouldn't even need to maintain a list of what requires authentication; we just make sure it's in the(authenticated)
group. We could even haveroutes/(authenticated)/(admin)/hooks.server.ts
to limit pages inroutes/(authenticated)/(admin)
to users who are admins.Anyway, just a thought. Thanks for considering.
Beta Was this translation helpful? Give feedback.
All reactions