mirror of
https://github.com/beilunyang/moemail.git
synced 2026-07-11 23:51:21 +08:00
feat: Init
This commit is contained in:
21
middleware.ts
Normal file
21
middleware.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { auth } from "@/lib/auth"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
export async function middleware() {
|
||||
const session = await auth()
|
||||
|
||||
if (!session) {
|
||||
return NextResponse.json(
|
||||
{ error: "Unauthorized" },
|
||||
{ status: 401 }
|
||||
)
|
||||
}
|
||||
|
||||
return NextResponse.next()
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/api/emails/:path*",
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user