Files
archived-next-auth/apps/dev/nextjs/middleware.ts
Balázs Orbán 23ea9428e0 update dev app
2023-04-13 14:43:25 +02:00

11 lines
323 B
TypeScript

// export { auth as default } from "auth"
import { auth } from "auth"
import { NextResponse } from "next/server"
export default auth((req) => {
if (req.auth) return NextResponse.json(req.auth)
return NextResponse.json("Not authorized", { status: 401 })
})
export const config = { matcher: ["/middleware-protected"] }