Unverified Commit 1d62f471 authored by Jordy Fontoura's avatar Jordy Fontoura Committed by GitHub

Fix comment numbering in middleware example in docs (#70465)

### 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: 's avatarJJ Kasper <jj@jjsweb.site>
parent 94c4e5da
...@@ -1059,12 +1059,12 @@ export default async function middleware(req: NextRequest) { ...@@ -1059,12 +1059,12 @@ export default async function middleware(req: NextRequest) {
const cookie = cookies().get('session')?.value const cookie = cookies().get('session')?.value
const session = await decrypt(cookie) 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) { if (isProtectedRoute && !session?.userId) {
return NextResponse.redirect(new URL('/login', req.nextUrl)) 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 ( if (
isPublicRoute && isPublicRoute &&
session?.userId && session?.userId &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment