Skip to content

Commit

Permalink
fix: middleware-upgrade-guide.md (#38246)
Browse files Browse the repository at this point in the history
* Update middleware-upgrade-guide.md

* Update middleware-upgrade-guide.md
  • Loading branch information
emersonlaurentino committed Jul 2, 2022
1 parent d609017 commit 6b8e499
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions errors/middleware-upgrade-guide.md
Expand Up @@ -119,7 +119,7 @@ import { isAuthValid } from './lib/auth'

export function middleware(request: NextRequest) {
// Example function to validate auth
if (isAuthValid(req)) {
if (isAuthValid(request)) {
return NextResponse.next()
}

Expand All @@ -137,7 +137,7 @@ import { isAuthValid } from './lib/auth'

export function middleware(request: NextRequest) {
// Example function to validate auth
if (isAuthValid(req)) {
if (isAuthValid(request)) {
return NextResponse.next()
}

Expand Down Expand Up @@ -323,9 +323,9 @@ Use [`URLPattern`](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern)
```typescript
// pages/_middleware.ts
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
import type { NextRequest, NextFetchEvent } from 'next/server'

export function middleware(request: NextRequest) {
export function middleware(request: NextRequest, event: NextFetchEvent) {
const { params } = event.request.page
const { locale, slug } = params

Expand Down

0 comments on commit 6b8e499

Please sign in to comment.