From a5c4af6a694f7fba516f322c1fa728431129df1e Mon Sep 17 00:00:00 2001 From: Lukas Moertl Date: Tue, 2 Jan 2024 12:13:00 +0100 Subject: [PATCH] fixes wordform frequencies for #8 --- src/composables/useMediaSourceSearch.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/composables/useMediaSourceSearch.ts b/src/composables/useMediaSourceSearch.ts index 8373ed7..23df3e9 100644 --- a/src/composables/useMediaSourceSearch.ts +++ b/src/composables/useMediaSourceSearch.ts @@ -38,21 +38,22 @@ export function useMediaSourceSearch() { //q: `${query.preparedQuery};${corpora.corporaForSearch};fttattr=doc.docsrc;fcrit=doc.id;flimit=0;format=json`, }, }); - if (!mediaSources?.value || mediaSources?.value.Blocks) { - query.loading.mediaSources = false; - return console.error("error on MediaSources"); - } + // // @ts-ignore + // if (!mediaSources?.value || !mediaSources?.value.Blocks) { + // query.loading.mediaSources = false; + // return console.error("error on MediaSources"); + // } const mediaSourceData = mediaSources.value as FreqMLDocsRC; console.log({ mediaSourceData, blocks: mediaSourceData.Blocks, // @ts-ignore - items: mediaSourceData.Blocks[0].Items, + items: mediaSourceData.Blocks[0]?.Items, }); // @ts-ignore - const WordformData = mediaSourceData.Blocks[0].Items; + const WordformData = (mediaSourceData.Blocks || [])[0]?.Items ?? []; WordformData.forEach(({ frq, Word, fpm }) => { query.data.mediaSources.push({ // @ts-ignore