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.
|
// (famId scoping) instead of running everything as superuser.
|
||||||
export function createPbClient(token?: string) {
|
export function createPbClient(token?: string) {
|
||||||
const pb = new PocketBase(PB_ENDPOINT);
|
const pb = new PocketBase(PB_ENDPOINT);
|
||||||
|
pb.autoCancellation(false);
|
||||||
if (token) pb.authStore.save(token, null);
|
if (token) pb.authStore.save(token, null);
|
||||||
return pb;
|
return pb;
|
||||||
}
|
}
|
||||||
@@ -33,6 +34,7 @@ let superClient: PocketBase | null = null;
|
|||||||
export async function createSuperClient() {
|
export async function createSuperClient() {
|
||||||
if (superClient) return superClient;
|
if (superClient) return superClient;
|
||||||
const pb = new PocketBase(PB_ENDPOINT);
|
const pb = new PocketBase(PB_ENDPOINT);
|
||||||
|
pb.autoCancellation(false);
|
||||||
await pb.collection('_superusers').authWithPassword(String(PB_EMAIL), String(PB_PASSWORD));
|
await pb.collection('_superusers').authWithPassword(String(PB_EMAIL), String(PB_PASSWORD));
|
||||||
superClient = pb;
|
superClient = pb;
|
||||||
return pb;
|
return pb;
|
||||||
|
|||||||
Reference in New Issue
Block a user