diff --git a/src/app/shared/services/disease/disease.service.ts b/src/app/shared/services/disease/disease.service.ts index abb2c56..b2e8d58 100644 --- a/src/app/shared/services/disease/disease.service.ts +++ b/src/app/shared/services/disease/disease.service.ts @@ -11,13 +11,15 @@ export interface Disease { type DiseaseResponse = Record; +const flattenResult = (rawItems: DiseaseResponse): Disease[] => Object.values(rawItems).flat(); + @Service() export class DiseaseService { private url = environment.resourceUrl; private readonly resource = httpResource(() => this.url); readonly diseases = computed(() => - this.resource.hasValue() ? Object.values(this.resource.value()).flat() : [], + this.resource.hasValue() ? flattenResult(this.resource.value()) : [], ); readonly isLoading = this.resource.isLoading;