diff --git a/src/routes/projects/espresso/registry/+page.svelte b/src/routes/projects/espresso/registry/+page.svelte index a4d37bc..ce49d5e 100644 --- a/src/routes/projects/espresso/registry/+page.svelte +++ b/src/routes/projects/espresso/registry/+page.svelte @@ -14,6 +14,7 @@ // API Querying let apiQueryError: string = ''; async function queryRegistryApi(term: string): Promise | undefined> { + apiQueryError = ''; try { const response = await fetch('http://localhost:8080/registry?q=' + encodeURI(term), { method: 'GET', @@ -23,13 +24,13 @@ }); if (!response.ok) { - apiQueryError = 'An error occurred: HTTP ' + response.status; + apiQueryError = 'An error occured while querying the API: HTTP ' + response.status; } const data = await response.json(); // Parse the response as JSON return data; // Return the data } catch (error) { - console.error('There was a problem with the fetch operation:', error); + apiQueryError = 'An error occured while querying the API: ' + error; } } let apiResponse: Array = []; @@ -51,23 +52,32 @@ {#if lineEditValue} -

- Searching registry at commit: 882be6a7e61d11d33dec508a789f009352a3e328 -

+ {#if apiQueryError} +
+

{apiQueryError}

+
+ {/if} + {#if apiResponse} +

+ Searching registry at commit: 882be6a7e61d11d33dec508a789f009352a3e328 +

+ {/if}
-
- {#each apiResponse as group} - {#each group.espressoPackages as pkg} -
- -
+ {#if apiResponse} +
+ {#each apiResponse as group} + {#each group.espressoPackages as pkg} +
+ +
+ {/each} {/each} - {/each} -
+
+ {/if}
{/if} @@ -76,4 +86,4 @@ .single-registry-card { @apply col-span-2 w-full; } - \ No newline at end of file +