Skip to content

Commit

Permalink
Fix comment numbering in middleware example in docs (vercel#70465)
Browse files Browse the repository at this point in the history
### What?
This PR fixes a numbering issue in the example code of the
documentation. The comments in the code jumped from step 3 to step 5, so
I renumbered them to maintain the correct sequence.

### Why?
Correcting the comment numbering improves the clarity and readability of
the code, ensuring that readers can follow the steps in the right order.

### How?
I changed step 5 to step 4 and step 6 to step 5, adjusting the comment
sequence without altering the logic or functionality of the code.

### Evidence


![image](https://github.com/user-attachments/assets/12b15de3-2cc3-4dca-9185-cde5a97cd0c3)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
2 people authored and abhi12299 committed Sep 29, 2024
1 parent 3ee8e76 commit 82c84ee
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1059,12 +1059,12 @@ export default async function middleware(req: NextRequest) {
const cookie = cookies().get('session')?.value
const session = await decrypt(cookie)

// 5. Redirect to /login if the user is not authenticated
// 4. Redirect to /login if the user is not authenticated
if (isProtectedRoute && !session?.userId) {
return NextResponse.redirect(new URL('/login', req.nextUrl))
}

// 6. Redirect to /dashboard if the user is authenticated
// 5. Redirect to /dashboard if the user is authenticated
if (
isPublicRoute &&
session?.userId &&
Expand Down

0 comments on commit 82c84ee

Please sign in to comment.