Skip to content

Commit

Permalink
fix catching errors in vocabulary lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Mar 25, 2024
1 parent f8e1af3 commit c202c59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/pat/contentbrowser/src/ContentBrowser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<p>...loading content items</p>
{:then levels}
<div class="levelColumns">
{#each (levels || []) as level, i (level.path)}
{#each levels as level, i (level.path)}
<div
class="levelColumn{i % 2 == 0 ? ' odd' : ' even'}"
in:fly|local={{ duration: 300 }}
Expand Down Expand Up @@ -218,7 +218,7 @@
{/if}
</div>
</div>
{#each level.results as item, n}
{#each (level.results || []) as item, n}
<div
class="contentItem{n % 2 == 0
? ' odd'
Expand Down Expand Up @@ -264,7 +264,7 @@
{/if}
</div>
{/each}
{#if level.results.length == 0}
{#if level.total == 0}
<div class="contentItem">
<p>no items found.</p>
</div>
Expand Down
17 changes: 5 additions & 12 deletions src/pat/contentbrowser/src/ContentStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ export default function (config, pathCache) {
size: 100,
})}`;

store.update((data) => {
delete data.errors;
data.loading = true;
return data;
});

let headers = new Headers();
headers.set("Accept", "application/json");
const body = params ? JSON.stringify(params) : undefined;
Expand All @@ -96,12 +90,11 @@ export default function (config, pathCache) {
}
return json;
} else {
store.update((data) => {
data.loading = false;
data.errors = json.errors;
return data;
});
return [];
return {
results: [],
total: 0,
errors: json.errors,
};
}
};

Expand Down

0 comments on commit c202c59

Please sign in to comment.