From b42677b1184b135ab2571721224ec61d5042b54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Fri, 13 Mar 2026 12:49:40 +0800 Subject: [PATCH] fix: resolve 'e.reduce is not a function' error in admin settings - Remove server-side grouping logic from API response - Return flat array instead of grouped object - Fix data structure mismatch between API and frontend - Resolve TypeError when accessing admin settings page --- src/app/api/admin/config/route.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/app/api/admin/config/route.ts b/src/app/api/admin/config/route.ts index 0673537..0e3d894 100644 --- a/src/app/api/admin/config/route.ts +++ b/src/app/api/admin/config/route.ts @@ -46,18 +46,8 @@ export async function GET(request: NextRequest) { .where(whereClause) .orderBy(siteConfig.key); - const groupedConfigs = configs.reduce((acc, config) => { - const cat = config.category; - if (!acc[cat]) { - acc[cat] = []; - } - acc[cat].push(config); - return acc; - }, {} as Record); - return success({ - configs: groupedConfigs, - flat: configs, + configs: configs, }); } catch (error) { return handleApiError(error);