We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 064cb31 commit f1fd5ccCopy full SHA for f1fd5cc
1 file changed
src/lib/components/ToolBadge.svelte
@@ -2,19 +2,22 @@
2
import ToolLogo from "./ToolLogo.svelte";
3
import { base } from "$app/paths";
4
import { browser } from "$app/environment";
5
+ import { throwOnError, useAPIClient } from "$lib/APIClient";
6
7
interface Props {
8
toolId: string;
9
}
10
11
let { toolId }: Props = $props();
12
+
13
+ const client = useAPIClient();
14
</script>
15
16
<div
17
class="relative flex items-center justify-center space-x-2 rounded border border-gray-300 bg-gray-200 px-2 py-1"
18
>
19
{#if browser}
- {#await fetch(`${base}/api/tools/${toolId}`).then((res) => res.json()) then value}
20
+ {#await client.tools({ id: toolId }).get().then(throwOnError) then value}
21
{#key value.color + value.icon}
22
<ToolLogo color={value.color} icon={value.icon} size="sm" />
23
{/key}
0 commit comments