Fix filters API response structure
Some checks failed
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 34s
Build and Push Docker Images / Build Frontend (Next.js) (push) Failing after 59s
Build and Push Docker Images / Trigger Portainer Update (push) Has been skipped

Backend returns filters directly at top level, not wrapped in 'filters' property.
Update FiltersResponse type and page components to match actual API response.

Fixes empty dropdowns for school types and local authorities.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Tudor
2026-02-02 21:51:08 +00:00
parent ef4932b553
commit 148e46ae6a
3 changed files with 4 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ export default async function HomePage({ searchParams }: HomePageProps) {
return ( return (
<HomeView <HomeView
initialSchools={schoolsData} initialSchools={schoolsData}
filters={filtersData?.filters || { local_authorities: [], school_types: [], years: [] }} filters={filtersData || { local_authorities: [], school_types: [], years: [] }}
/> />
); );
} catch (error) { } catch (error) {

View File

@@ -49,7 +49,7 @@ export default async function RankingsPage({ searchParams }: RankingsPageProps)
return ( return (
<RankingsView <RankingsView
rankings={rankingsResponse?.rankings || []} rankings={rankingsResponse?.rankings || []}
filters={filtersResponse?.filters || { local_authorities: [], school_types: [], years: [] }} filters={filtersResponse || { local_authorities: [], school_types: [], years: [] }}
metrics={metricsArray} metrics={metricsArray}
selectedMetric={metric} selectedMetric={metric}
selectedArea={local_authority} selectedArea={local_authority}

View File

@@ -182,9 +182,8 @@ export interface Filters {
years: number[]; years: number[];
} }
export interface FiltersResponse { // Backend returns filters directly, not wrapped
filters: Filters; export type FiltersResponse = Filters;
}
export interface MetricDefinition { export interface MetricDefinition {
key: string; key: string;