git: 원격 저장소 연결 및 초기 커밋
Made-with: Cursor
This commit is contained in:
19
src/lib/pocketBase.js
Normal file
19
src/lib/pocketBase.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import PocketBase from 'pocketbase'
|
||||
import { toApiUrl } from '@/lib/apiUrl'
|
||||
|
||||
/** @type {PocketBase | null} */
|
||||
let client = null
|
||||
|
||||
/**
|
||||
* @returns {PocketBase}
|
||||
*/
|
||||
export function getPocketBase() {
|
||||
const base = import.meta.env.VITE_POCKETBASE_URL
|
||||
if (!base) {
|
||||
throw new Error('VITE_POCKETBASE_URL이 설정되지 않았습니다.')
|
||||
}
|
||||
if (!client) {
|
||||
client = new PocketBase(toApiUrl(base))
|
||||
}
|
||||
return client
|
||||
}
|
||||
Reference in New Issue
Block a user