Fix the access of results after API call

This commit is contained in:
2025-08-20 16:03:56 +02:00
parent 7dcb8abe38
commit 59e8d9d516

View File

@@ -96,14 +96,14 @@ onMounted(() => {
const getAccompanyingPeriodWorks = (periodId: number) => { const getAccompanyingPeriodWorks = (periodId: number) => {
const url = `/api/1.0/person/accompanying-course/${periodId}/works.json`; const url = `/api/1.0/person/accompanying-course/${periodId}/works.json`;
makeFetch<number, AccompanyingPeriodWork[]>("GET", url) makeFetch<number, {results: AccompanyingPeriodWork[]}>("GET", url)
.then((response) => { .then((response) => {
if (props.isEvaluationSelector) { if (props.isEvaluationSelector) {
accompanyingPeriodWorks.value = response.filter( accompanyingPeriodWorks.value = response.results.filter(
(acpw) => acpw.accompanyingPeriodWorkEvaluations.length > 0, (acpw) => acpw.accompanyingPeriodWorkEvaluations.length > 0,
); );
} else { } else {
accompanyingPeriodWorks.value = response; accompanyingPeriodWorks.value = response.results;
} }
}) })
.catch((error) => { .catch((error) => {