Files
moemail/middleware.ts
2024-12-18 01:59:34 +08:00

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*",
]
}