unify single user and multi user behaviour

This commit is contained in:
Davide Scaini
2026-04-09 08:58:35 +02:00
parent 2007f53580
commit 98c42dc443
25 changed files with 678 additions and 232 deletions
+8 -2
View File
@@ -161,10 +161,16 @@ export async function loadActivity(
/**
* Load athlete profile. Athlete data is not stored locally yet, so this is
* always a network fetch with a graceful null on failure.
*
* @param baseUrl Site base URL (used to build the default path)
* @param athleteUrl Explicit full URL — use for per-user pages in multi-user mode
*/
export async function loadAthlete(baseUrl: string): Promise<Record<string, unknown> | null> {
export async function loadAthlete(
baseUrl: string,
athleteUrl?: string,
): Promise<Record<string, unknown> | null> {
try {
return await fetchJSON(`${baseUrl}data/athlete.json`);
return await fetchJSON(athleteUrl ?? `${baseUrl}data/athlete.json`);
} catch {
return null;
}