Новые изменения
This commit is contained in:
parent
dc00e31578
commit
e621b3c40e
8 changed files with 234 additions and 54 deletions
16
frontend/src/lib/pbServer.ts
Normal file
16
frontend/src/lib/pbServer.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import PocketBase from 'pocketbase';
|
||||
|
||||
const PB_URL = import.meta.env.POCKETBASE_URL || 'http://127.0.0.1:8090';
|
||||
const PB_ADMIN_EMAIL = import.meta.env.PB_ADMIN_EMAIL || 'admin@example.com';
|
||||
const PB_ADMIN_PASSWORD = import.meta.env.PB_ADMIN_PASSWORD || 'admin_password';
|
||||
|
||||
const pbServer = new PocketBase(PB_URL);
|
||||
|
||||
export { pbServer };
|
||||
|
||||
export async function initPbServer() {
|
||||
if (!pbServer.authStore.isValid) {
|
||||
await pbServer.collection('_superusers').authWithPassword(PB_ADMIN_EMAIL, PB_ADMIN_PASSWORD);
|
||||
}
|
||||
return pbServer;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue