add pocketbase
This commit is contained in:
15
composables/usePB.ts
Normal file
15
composables/usePB.ts
Normal file
@ -0,0 +1,15 @@
|
||||
// import { ref } from 'vue';
|
||||
import pocketbase from "pocketbase";
|
||||
|
||||
export const usePB = () => {
|
||||
const nuxtApp = useNuxtApp();
|
||||
|
||||
const isServer = !!nuxtApp.ssrContext;
|
||||
if (isServer) {
|
||||
const pb = new pocketbase(process.env.POCKETBASE_URL || "http://127.0.0.1:8090");
|
||||
return pb;
|
||||
}
|
||||
|
||||
const pb = new pocketbase(window.location.origin);
|
||||
return pb;
|
||||
};
|
Reference in New Issue
Block a user