Skip to content

Commit 002a59d

Browse files
committed
fix: fix loading delete record
1 parent b1f002c commit 002a59d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apps/frontend/src/lib/components/blocks/delete-record/confirm-delete-record.svelte

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import { createMutation, useQueryClient } from "@tanstack/svelte-query"
88
import { queryParam } from "sveltekit-search-params"
99
import { toast } from "svelte-sonner"
10+
import Button from "$lib/components/ui/button/button.svelte"
11+
import { Loader2Icon } from "lucide-svelte"
1012
1113
const deleteRecordId = queryParam("deleteRecordId")
1214
@@ -61,8 +63,13 @@
6163
>
6264
Cancel
6365
</AlertDialog.Cancel>
64-
<AlertDialog.Action class="text-background bg-red-500 hover:bg-red-600" on:click={onDelete}>
65-
Delete
66+
<AlertDialog.Action asChild>
67+
<Button on:click={onDelete} variant="destructive" disabled={$deleteRecordMutation.isPending}>
68+
{#if $deleteRecordMutation.isPending}
69+
<Loader2Icon class="mr-2 size-3 animate-spin" />
70+
{/if}
71+
Delete
72+
</Button>
6673
</AlertDialog.Action>
6774
</AlertDialog.Footer>
6875
</AlertDialog.Content>

0 commit comments

Comments
 (0)