gropu and sort lessons
All checks were successful
platform/bro/pipeline/head This commit looks good

This commit is contained in:
Primakov Alexandr Alexandrovich 2024-04-09 23:38:51 +03:00
parent 99c95d0706
commit fc3366d52a

View File

@ -194,7 +194,7 @@ const LessonList = () => {
const toastRef = useRef(null)
const createdLessonRef = useRef(null)
const [editLesson, setEditLesson] = useState<Lesson>(null)
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date < b.date ? 1 : -1), [data, data?.body])
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date > b.date ? 1 : -1), [data, data?.body])
const lessonCalc = useMemo(() => {
if (!isSuccess) {
@ -223,7 +223,7 @@ const LessonList = () => {
}
}
return lessonsData
return lessonsData.sort((a, b) => a.date < b.date? 1 : -1)
}, [groupByDate, isSuccess, sorted])
const onSubmit = (lessonData) => {