This commit is contained in:
eric
2026-03-08 10:13:12 -05:00
parent 1f4473cb04
commit 7af7651104
2 changed files with 5 additions and 2 deletions

View File

@@ -11,7 +11,8 @@ async function getAdminToken(): Promise<string | null> {
const password = process.env.POCKETBASE_PASSWORD;
if (!email || !password) return null;
const res = await fetch(`${PB_URL}/api/admins/auth-with-password`, {
const pb = getPocketBaseConfig();
const res = await fetch(`${pb.url}/api/admins/auth-with-password`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ identity: email, password }),

View File

@@ -8,7 +8,9 @@ export async function POST(request: NextRequest) {
const form = await request.formData();
const file = form.get("file");
const fileObj =
file instanceof File ? file : file instanceof Blob ? file : null;
file != null && typeof file === "object" && "size" in file
? (file as File | Blob)
: null;
if (!fileObj || fileObj.size === 0) {
return NextResponse.json(