Disable login temporarily
This commit is contained in:
24
src/_middleware.ts
Normal file
24
src/_middleware.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// import { auth } from "@/auth"
|
||||||
|
// import type { NextRequest } from "next/server"
|
||||||
|
// import { NextResponse } from "next/server"
|
||||||
|
|
||||||
|
// export async function middleware(request: NextRequest) {
|
||||||
|
// const session = await auth()
|
||||||
|
|
||||||
|
// const isProtectedPath =
|
||||||
|
// !request.nextUrl.pathname.startsWith("/api/auth") &&
|
||||||
|
// !request.nextUrl.pathname.startsWith("/_next") &&
|
||||||
|
// !request.nextUrl.pathname.startsWith("/favicon") &&
|
||||||
|
// !request.nextUrl.pathname.startsWith("/assets")
|
||||||
|
|
||||||
|
// if (isProtectedPath && !session) {
|
||||||
|
// const signInUrl = new URL("/api/auth/signin", request.url)
|
||||||
|
// return NextResponse.redirect(signInUrl)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return NextResponse.next()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export const config = {
|
||||||
|
// matcher: ["/((?!api/auth|_next/static|_next/image|favicon.ico).*)"],
|
||||||
|
// }
|
@ -1,16 +1,16 @@
|
|||||||
import { auth } from "@/auth";
|
// import { auth } from "@/auth";
|
||||||
import { SignInOutButton } from "../auth/SignInOutButton";
|
// import { SignInOutButton } from "../auth/SignInOutButton";
|
||||||
import ModeToggle from "./ModeToggle";
|
import ModeToggle from "./ModeToggle";
|
||||||
import TopNav from "./TopNav";
|
import TopNav from "./TopNav";
|
||||||
|
|
||||||
export default async function Header() {
|
export default async function Header() {
|
||||||
const session = await auth()
|
// const session = await auth()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<TopNav />
|
<TopNav />
|
||||||
<div className="flex items-center justify-between gap-4">
|
<div className="flex items-center justify-between gap-4">
|
||||||
<SignInOutButton session={session} />
|
{/* <SignInOutButton session={session} /> */}
|
||||||
<ModeToggle />
|
<ModeToggle />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import { auth } from "@/auth"
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
export async function middleware(request: NextRequest) {
|
|
||||||
const session = await auth()
|
|
||||||
|
|
||||||
const isProtectedPath =
|
|
||||||
!request.nextUrl.pathname.startsWith("/api/auth") &&
|
|
||||||
!request.nextUrl.pathname.startsWith("/_next") &&
|
|
||||||
!request.nextUrl.pathname.startsWith("/favicon") &&
|
|
||||||
!request.nextUrl.pathname.startsWith("/assets")
|
|
||||||
|
|
||||||
if (isProtectedPath && !session) {
|
|
||||||
const signInUrl = new URL("/api/auth/signin", request.url)
|
|
||||||
return NextResponse.redirect(signInUrl)
|
|
||||||
}
|
|
||||||
|
|
||||||
return NextResponse.next()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const config = {
|
|
||||||
matcher: ["/((?!api/auth|_next/static|_next/image|favicon.ico).*)"],
|
|
||||||
}
|
|
Reference in New Issue
Block a user