fix pb concurrency

This commit is contained in:
JCEEE
2026-08-18 09:15:06 +01:00
parent 29cb6a3ea5
commit 77b56a8186
+2
View File
@@ -13,6 +13,7 @@ export const PB_ENDPOINT = import.meta.env.PROD
// (famId scoping) instead of running everything as superuser.
export function createPbClient(token?: string) {
const pb = new PocketBase(PB_ENDPOINT);
pb.autoCancellation(false);
if (token) pb.authStore.save(token, null);
return pb;
}
@@ -33,6 +34,7 @@ let superClient: PocketBase | null = null;
export async function createSuperClient() {
if (superClient) return superClient;
const pb = new PocketBase(PB_ENDPOINT);
pb.autoCancellation(false);
await pb.collection('_superusers').authWithPassword(String(PB_EMAIL), String(PB_PASSWORD));
superClient = pb;
return pb;