import { cleanCategoryCard, getUrlWithProxiedParams } from '../../../runtime'; import type { IRawGroupCategories } from '../../../types'; export default defineEventHandler(async (event) => { const apiUrl = process.env.NUXT_PUBLIC_API_DOMAIN; const url = getUrlWithProxiedParams(`${apiUrl}/v1/groups-categories/all`, event); const data = await cachedApiFetch<{ items?: IRawGroupCategories[] }>(url, event, 600); const items = data?.items; return Array.isArray(items) ? items.map((item: IRawGroupCategories) => ({ name: item.name, title: item.title, weight: item.weight, icon: item.icon, categories: Array.isArray(item.categories) ? item.categories.map(cleanCategoryCard) : [] })) : []; });