Skip to content

How to reuse auth code for directory based routing #4229

Answered by RMHonor
nirav-blitzm asked this question in Q&A
Discussion options

You must be logged in to vote

The pathless route can be a directory, this is what I do

src/routes
|── _auth
│   ├── faq
│   │   ├── route.tsx
│   ├── help
│   │   ├── route.tsx
│   ├── dashboard.tsx
│   ├── route.tsx // auth logic lives here
|── login.tsx
|── index.tsx

Or you can use the _auth prefix on your directories:

src/routes
|── _auth.faq
│   ├── route.tsx
│── _auth.help
│   ├── route.tsx
│── _auth.dashboard.tsx
│── _auth.tsx // auth logic lives here
|── login.tsx
|── index.tsx

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nirav-blitzm
Comment options

Answer selected by nirav-blitzm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants