build fix
This commit is contained in:
14
lib/auth.ts
14
lib/auth.ts
@@ -1,3 +1,4 @@
|
||||
import type Database from "better-sqlite3";
|
||||
import crypto from "node:crypto";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
@@ -62,12 +63,7 @@ function decodeSession(value: string | undefined): SessionPayload | null {
|
||||
}
|
||||
}
|
||||
|
||||
export function bootstrapAdminUser(db: {
|
||||
prepare: (sql: string) => {
|
||||
get: (...args: unknown[]) => unknown;
|
||||
run: (...args: unknown[]) => unknown;
|
||||
};
|
||||
}) {
|
||||
export function bootstrapAdminUser(db: Database.Database) {
|
||||
const countRow = db.prepare(`SELECT COUNT(*) AS count FROM users`).get() as { count: number };
|
||||
|
||||
if ((countRow.count ?? 0) > 0) {
|
||||
@@ -121,11 +117,7 @@ export async function destroySession() {
|
||||
}
|
||||
|
||||
export function authenticateUser(
|
||||
db: {
|
||||
prepare: (sql: string) => {
|
||||
get: (...args: unknown[]) => unknown;
|
||||
};
|
||||
},
|
||||
db: Database.Database,
|
||||
email: string,
|
||||
password: string
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user