mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
dev day #77
This commit is contained in:
@@ -197,6 +197,8 @@ const SettingsAdminPage: React.FC = () => {
|
||||
(typeof (settings as any).location_latitude === 'number') &&
|
||||
(typeof (settings as any).location_longitude === 'number'),
|
||||
map_style: (settings as any).map_style,
|
||||
frontend_base_url: (settings as any).frontend_base_url,
|
||||
api_base_url: (settings as any).api_base_url,
|
||||
// homepage matches display
|
||||
finished_match_display_days: (settings as any).finished_match_display_days as any,
|
||||
};
|
||||
@@ -205,6 +207,22 @@ const SettingsAdminPage: React.FC = () => {
|
||||
toast({ title: 'Uloženo', description: 'Nastavení bylo úspěšně aktualizováno', status: 'success' });
|
||||
// Try to refresh prefetch caches
|
||||
try { await triggerPrefetch(); } catch {}
|
||||
try {
|
||||
const fb = String(((saved as any).frontend_base_url || (settings as any).frontend_base_url || '')).replace(/\/$/, '');
|
||||
let ab = String(((saved as any).api_base_url || (settings as any).api_base_url || '')).trim();
|
||||
if (fb || ab) {
|
||||
try {
|
||||
const u = new URL(ab || '', fb || (typeof window !== 'undefined' ? window.location.origin : ''));
|
||||
if (!/\/api\//.test(u.pathname)) { u.pathname = u.pathname.replace(/\/$/, '') + '/api/v1'; }
|
||||
ab = u.toString();
|
||||
} catch {}
|
||||
try { localStorage.setItem('fc_frontend_base_url', fb); } catch {}
|
||||
try { localStorage.setItem('fc_api_base_url', ab); } catch {}
|
||||
try { localStorage.setItem('api_base_url', ab); } catch {}
|
||||
try { (api as any).defaults.baseURL = ab; } catch {}
|
||||
setTimeout(() => { try { window.location.reload(); } catch {} }, 600);
|
||||
}
|
||||
} catch {}
|
||||
} catch (e: any) {
|
||||
toast({ title: 'Chyba', description: e?.message || 'Uložení nastavení se nezdařilo', status: 'error' });
|
||||
} finally {
|
||||
@@ -271,6 +289,17 @@ const SettingsAdminPage: React.FC = () => {
|
||||
|
||||
<Divider />
|
||||
|
||||
<Heading size="sm">Nastavení URL</Heading>
|
||||
<FormControl>
|
||||
<FormLabel>URL webu</FormLabel>
|
||||
<Input value={(settings as any).frontend_base_url || ''} onChange={handleChange('frontend_base_url' as any)} placeholder="https://www.vasklub.cz" />
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>API URL</FormLabel>
|
||||
<Input value={(settings as any).api_base_url || ''} onChange={handleChange('api_base_url' as any)} placeholder="https://api.vasklub.cz/api/v1" />
|
||||
<FormHelperText>Ujistěte se, že adresa končí na /api/v1</FormHelperText>
|
||||
</FormControl>
|
||||
|
||||
<Heading size="sm">Zobrazení zápasů</Heading>
|
||||
<FormControl>
|
||||
<FormLabel>Počet dní zobrazení dokončených zápasů</FormLabel>
|
||||
|
||||
Reference in New Issue
Block a user