Add pocketbase util
This commit is contained in:
13
web/src/utils/pocketbase.ts
Normal file
13
web/src/utils/pocketbase.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import PocketBase from "pocketbase";
|
||||
|
||||
const pb = new PocketBase("/");
|
||||
|
||||
export const authPB = async () => {
|
||||
if (!pb.authStore.isValid) {
|
||||
await pb.collection('users').authWithPassword(
|
||||
import.meta.env.PB_EMAIL,
|
||||
import.meta.env.PB_PW
|
||||
);
|
||||
}
|
||||
return pb;
|
||||
};
|
||||
Reference in New Issue
Block a user