import { NextRequest, NextResponse } from "next/server";
import pb from "./lib/pocketbase";
import { isAuthenticated } from "./lib/auth";

export async function middleware(request: NextRequest) {
  const { pathname } = request.nextUrl;
  if (
    pathname.startsWith("/_next") ||
    pathname.startsWith("/api") ||
    pathname.startsWith("/static")
  ) {
    return NextResponse.next();
  }
  // const isLoggedIn = await isAuthenticated(request.cookies as any);
  // if (pathname.startsWith("/account")) {
  //   if (isLoggedIn) {
  //     return NextResponse.next();
  //   } else {
  //     request.nextUrl.pathname = "/"
  //   }
  //   return NextResponse.redirect(request.nextUrl);
  // }
  // return NextResponse.next();
}
