``update Add error constant for empty PocketBase URL and validate it during app initialization ``

This commit is contained in:
2025-05-16 15:56:56 +08:00
parent aa834a43c9
commit 6b917c9fb9
2 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1 @@
export const ERR_POCKETBASE_URL_IS_EMPTY = 'POCKETBASE url is empty';

View File

@@ -8,6 +8,10 @@
// 0.0.7 - add back button for listening practice, matching frenzy, connective revision // 0.0.7 - add back button for listening practice, matching frenzy, connective revision
// 0.0.8 - add back button for listening practice card, matching frenzy card, connective revision card // 0.0.8 - add back button for listening practice card, matching frenzy card, connective revision card
// 0.0.9 - fix ticket 26,27,28,29 // 0.0.9 - fix ticket 26,27,28,29
import { Capacitor } from '@capacitor/core';
import { ERR_POCKETBASE_URL_IS_EMPTY } from './ERRORS';
// 0.0.10 - remove debug symbol and re-route ending page // 0.0.10 - remove debug symbol and re-route ending page
const VERSIONS = 'v0.0.10'; const VERSIONS = 'v0.0.10';
const HELLOWORLD_MP3 = '/helloworld.mp3'; const HELLOWORLD_MP3 = '/helloworld.mp3';
@@ -76,11 +80,14 @@ const TEST = process.env.NODE_ENV === 'test';
const MY_FAVORITE = 'My Favorite'; const MY_FAVORITE = 'My Favorite';
// //
if (!import.meta.env.VITE_POCKETBASE_URL) throw new Error(ERR_POCKETBASE_URL_IS_EMPTY);
const POCKETBASE_URL = import.meta.env.VITE_POCKETBASE_URL; const POCKETBASE_URL = import.meta.env.VITE_POCKETBASE_URL;
// //
// database constants // database constants
export const COL_USERS = 'users'; export const COL_USERS = 'users';
export const COL_USER_METAS = 'UserMetas'; export const COL_USER_METAS = 'UserMetas';
//
export const RUNNING_PLATFORM = Capacitor.getPlatform();
export { export {
// //