added tons of features
This commit is contained in:
18
middlewares/withAuthMiddleware.ts
Normal file
18
middlewares/withAuthMiddleware.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {type NextMiddlewareResult} from 'next/dist/server/web/types'
|
||||
import type {NextFetchEvent, NextRequest} from 'next/server'
|
||||
import {NextResponse} from 'next/server'
|
||||
|
||||
import {CustomMiddleware} from './chain'
|
||||
import {auth} from '@/auth'
|
||||
|
||||
export function withAuthMiddleware(
|
||||
middleware: CustomMiddleware
|
||||
): CustomMiddleware {
|
||||
return async (
|
||||
request: NextRequest,
|
||||
event: NextFetchEvent,
|
||||
response: NextResponse
|
||||
): Promise<NextMiddlewareResult> => {
|
||||
return middleware(request, event, response)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user