fix pb concurrency
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user