Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: show actual backend error messages on login page and add missing db import

jubnle71bd6768e84
diff --git a/client/src/pages/LoginPage.tsx b/client/src/pages/LoginPage.tsx
index 14748380c..fd4834156 100644
--- a/client/src/pages/LoginPage.tsx
+++ b/client/src/pages/LoginPage.tsx
@@ -4,6 +4,7 @@ import { useAuthStore } from '../store/authStore'
import { useSettingsStore } from '../store/settingsStore'
import { SUPPORTED_LANGUAGES, useTranslation } from '../i18n'
import { authApi } from '../api/client'
+import { getApiErrorMessage } from '../types'
import { Plane, Eye, EyeOff, Mail, Lock, MapPin, Calendar, Package, User, Globe, Zap, Users, Wallet, Map, CheckSquare, BookMarked, FolderOpen, Route, Shield, KeyRound } from 'lucide-react'
interface AppConfig {
@@ -171,7 +172,7 @@ export default function LoginPage(): React.ReactElement {
setShowTakeoff(true)
setTimeout(() => navigate('/dashboard'), 2600)
} catch (err: unknown) {
- setError(err instanceof Error ? err.message : t('login.error'))
+ setError(getApiErrorMessage(err, t('login.error')))
setIsLoading(false)
}
}
diff --git a/server/src/index.ts b/server/src/index.ts
index 84a1f553a..328387d76 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -203,7 +203,7 @@ app.use('/api/admin', adminRoutes);
// Public addons endpoint (authenticated but not admin-only)
import { authenticate as addonAuth } from './middleware/auth';
-import { db as addonDb } from './db/database';
+import {db, db as addonDb} from './db/database';
import { Addon } from './types';
app.get('/api/addons', addonAuth, (req: Request, res: Response) => {
const addons = addonDb.prepare('SELECT id, name, type, icon, enabled FROM addons WHERE enabled = 1 ORDER BY sort_order').all() as Pick<Addon, 'id' | 'name' | 'type' | 'icon' | 'enabled'>[];