From dab7366cea4d70bd4d9c46403cadbb3afd112c10 Mon Sep 17 00:00:00 2001 From: matushl Date: Sun, 24 Nov 2024 01:14:05 +0100 Subject: [PATCH] Sort schools in school dropdown --- src/components/SchoolSubForm/SchoolSubForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SchoolSubForm/SchoolSubForm.tsx b/src/components/SchoolSubForm/SchoolSubForm.tsx index d8eede36..a6f29004 100644 --- a/src/components/SchoolSubForm/SchoolSubForm.tsx +++ b/src/components/SchoolSubForm/SchoolSubForm.tsx @@ -49,7 +49,7 @@ export const SchoolSubForm = ({control, watch, setValue, gap}: SchoolSubFormProp queryKey: ['personal', 'schools'], queryFn: () => axios.get(`/api/personal/schools`), }) - const schools = schoolsData?.data ?? [] + const schools = (schoolsData?.data ?? []).sort((a, b) => a.name.localeCompare(b.name)) const allSchoolItems: SelectOption[] = schools.map(({code, city, name, street}) => ({ id: code, label: city ? `${name} ${street}, ${city}` : name,