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 API keys not loading after reload, auto-save before validate (v2.3.5)

Maurice74be63555dd0
diff --git a/client/src/pages/AdminPage.jsx b/client/src/pages/AdminPage.jsx
index ceeecfa1f..fefc81b96 100644
--- a/client/src/pages/AdminPage.jsx
+++ b/client/src/pages/AdminPage.jsx
@@ -78,9 +78,9 @@ export default function AdminPage() {
const loadApiKeys = async () => {
try {
- const data = await authApi.me()
- setMapsKey(data.user?.maps_api_key || '')
- setWeatherKey(data.user?.openweather_api_key || '')
+ const data = await authApi.getSettings()
+ setMapsKey(data.settings?.maps_api_key || '')
+ setWeatherKey(data.settings?.openweather_api_key || '')
} catch (err) {
// ignore
}
@@ -118,6 +118,8 @@ export default function AdminPage() {
const handleValidateKeys = async () => {
setValidating({ maps: true, weather: true })
try {
+ // Save first so validation uses the current values
+ await updateApiKeys({ maps_api_key: mapsKey, openweather_api_key: weatherKey })
const result = await authApi.validateKeys()
setValidation(result)
} catch (err) {
@@ -130,6 +132,8 @@ export default function AdminPage() {
const handleValidateKey = async (keyType) => {
setValidating(prev => ({ ...prev, [keyType]: true }))
try {
+ // Save first so validation uses the current values
+ await updateApiKeys({ maps_api_key: mapsKey, openweather_api_key: weatherKey })
const result = await authApi.validateKeys()
setValidation(prev => ({ ...prev, [keyType]: result[keyType] }))
} catch (err) {
diff --git a/server/package.json b/server/package.json
index 377cc5cd9..cbcb58828 100644
--- a/server/package.json
+++ b/server/package.json
@@ -1,6 +1,6 @@
{
"name": "nomad-server",
- "version": "2.3.4",
+ "version": "2.3.5",
"main": "src/index.js",
"scripts": {
"start": "node --experimental-sqlite src/index.js",