Skip to content

Commit

Permalink
fix(ts): handleMiddleware return type can be NextMiddlewareResult (
Browse files Browse the repository at this point in the history
…#4818)

Co-authored-by: Lluis Agusti <hi@llu.lu>
  • Loading branch information
terrierscript and ubbe-xyz committed Jul 13, 2022
1 parent 70ffa65 commit 8853000
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next-auth/src/next/middleware.ts
Expand Up @@ -92,10 +92,12 @@ export interface NextAuthMiddlewareOptions {
secret?: string
}

type NextMiddlewareResult = ReturnType<NextMiddleware>

async function handleMiddleware(
req: NextRequest,
options: NextAuthMiddlewareOptions | undefined,
onSuccess?: (token: JWT | null) => Promise<any>
onSuccess?: (token: JWT | null) => Promise<NextMiddlewareResult>
) {
const signInPage = options?.pages?.signIn ?? "/api/auth/signin"
const errorPage = options?.pages?.error ?? "/api/auth/error"
Expand Down

0 comments on commit 8853000

Please sign in to comment.