import { fetchEntities } from '#/src/entities.js';

export async function onBeforeRender(pageContext) {
	const networks = await fetchEntities(pageContext.urlParsed.search.q
		? { query: pageContext.urlParsed.search.q }
		: { type: 'primary' });

	return {
		pageContext: {
			title: 'Channels',
			pageProps: {
				networks,
			},
		},
	};
}