Add pocketbase util

This commit is contained in:
2025-11-14 09:57:07 +13:00
parent bd746f4e75
commit e930e75646
7 changed files with 117 additions and 0 deletions

7
web/package-lock.json generated
View File

@@ -11,6 +11,7 @@
"@astrojs/node": "^9.5.0",
"@tailwindcss/vite": "^4.1.17",
"astro": "^5.15.4",
"pocketbase": "^0.26.3",
"tailwindcss": "^4.1.17"
}
},
@@ -4398,6 +4399,12 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/pocketbase": {
"version": "0.26.3",
"resolved": "https://registry.npmjs.org/pocketbase/-/pocketbase-0.26.3.tgz",
"integrity": "sha512-5deUKRoEczpxxuHzwr6/DHVmgbggxylEVig8CKN+MjvtYxPUqX/C6puU0yaR2yhTi8zrh7J9s7Ty+qBGwVzWOQ==",
"license": "MIT"
},
"node_modules/postcss": {
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",

View File

@@ -12,6 +12,7 @@
"@astrojs/node": "^9.5.0",
"@tailwindcss/vite": "^4.1.17",
"astro": "^5.15.4",
"pocketbase": "^0.26.3",
"tailwindcss": "^4.1.17"
}
}

View 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;
};