mirror of
https://github.com/beilunyang/moemail.git
synced 2025-09-27 03:46:03 +08:00
22 lines
395 B
TypeScript
22 lines
395 B
TypeScript
import { auth } from "@/lib/auth"
|
|
import { NextResponse } from "next/server"
|
|
|
|
export async function middleware() {
|
|
const session = await auth()
|
|
|
|
if (!session?.user) {
|
|
return NextResponse.json(
|
|
{ error: "Unauthorized" },
|
|
{ status: 401 }
|
|
)
|
|
}
|
|
|
|
return NextResponse.next()
|
|
}
|
|
|
|
export const config = {
|
|
matcher: [
|
|
"/api/emails/:path*",
|
|
"/api/webhook/:path*",
|
|
]
|
|
}
|