16 lines
364 B
TypeScript
16 lines
364 B
TypeScript
// 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;
|
|
};
|