import { api } from '$lib/api'; import type { PageLoad } from './$types'; export const load: PageLoad = async ({ parent, params }) => { const { match } = await parent(); // Only load weapons data if match is parsed if (!match.demo_parsed) { return { match, weaponsData: null, meta: { title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF` } }; } try { const weaponsData = await api.matches.getMatchWeapons(params.id); return { match, weaponsData, meta: { title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF` } }; } catch (err) { console.error(`Failed to load weapons data for match ${params.id}:`, err); // Return null instead of throwing error return { match, weaponsData: null, meta: { title: `${match.map || 'Match'} Details - Match ${match.match_id} - CS2.WTF` } }; } };