Skip to content

Commit f1fd5cc

Browse files
committed
feat: use api client for tool badge
1 parent 064cb31 commit f1fd5cc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/components/ToolBadge.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
import ToolLogo from "./ToolLogo.svelte";
33
import { base } from "$app/paths";
44
import { browser } from "$app/environment";
5+
import { throwOnError, useAPIClient } from "$lib/APIClient";
56
67
interface Props {
78
toolId: string;
89
}
910
1011
let { toolId }: Props = $props();
12+
13+
const client = useAPIClient();
1114
</script>
1215

1316
<div
1417
class="relative flex items-center justify-center space-x-2 rounded border border-gray-300 bg-gray-200 px-2 py-1"
1518
>
1619
{#if browser}
17-
{#await fetch(`${base}/api/tools/${toolId}`).then((res) => res.json()) then value}
20+
{#await client.tools({ id: toolId }).get().then(throwOnError) then value}
1821
{#key value.color + value.icon}
1922
<ToolLogo color={value.color} icon={value.icon} size="sm" />
2023
{/key}

0 commit comments

Comments
 (0)