local conversion
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import MmpChart from './MmpChart.svelte';
|
||||
import RecordsView from './RecordsView.svelte';
|
||||
import AthleteDrawer from './AthleteDrawer.svelte';
|
||||
import { loadIndex, loadAthlete } from '../lib/dataloader';
|
||||
|
||||
export let base: string = '/';
|
||||
|
||||
@@ -32,13 +33,12 @@
|
||||
activeTab = TABS.includes(rawTab as Tab) ? (rawTab as Tab) : 'power';
|
||||
mounted = true;
|
||||
try {
|
||||
const [athleteRes, indexRes] = await Promise.all([
|
||||
fetch(`${import.meta.env.BASE_URL}data/athlete.json`),
|
||||
fetch(`${import.meta.env.BASE_URL}data/index.json`),
|
||||
const [athleteData, index] = await Promise.all([
|
||||
loadAthlete(import.meta.env.BASE_URL),
|
||||
loadIndex(import.meta.env.BASE_URL),
|
||||
]);
|
||||
if (!athleteRes.ok) throw new Error('athlete.json not found — run bincio extract first');
|
||||
athlete = await athleteRes.json();
|
||||
const index: BASIndex = await indexRes.json();
|
||||
if (!athleteData) throw new Error('athlete.json not found — run bincio extract first');
|
||||
athlete = athleteData;
|
||||
activities = index.activities.filter(a => a.mmp && a.privacy !== 'private');
|
||||
} catch (e: any) {
|
||||
error = e.message;
|
||||
|
||||
Reference in New Issue
Block a user