import { browser } from '$app/environment';
import { events_func } from '$lib/ae_events/ae_events_functions';

export async function load({ params, parent }) {
    const data = await parent();
    const event_id = params.event_id;

    if (browser && event_id && data.ae_api?.base_url) {
        // Fire and forget — writes to IDB so the liveQuery in +page.svelte reacts.
        events_func.search__event_badge({
            api_cfg: data.ae_api,
            event_id,
            limit: 5000
        });
    }

    return data;
}
