import { api } from '../lib/api';

// [DEF:load:Function]
/* @PURPOSE: Loads initial plugin data for the dashboard.
   @PRE: None.
   @POST: Returns an object with plugins or an error message.
*/
/** @type {import('./$types').PageLoad} */
export async function load() {
    try {
        const plugins = await api.getPlugins();
        return {
            plugins
        };
    } catch (error) {
        console.error('Failed to load plugins:', error);
        return {
            plugins: [],
            error: 'Failed to load plugins'
        };
    }
}
// [/DEF:load:Function]
