Skip to content

Commit

Permalink
fix: fix loading delete record
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin committed Oct 21, 2024
1 parent b1f002c commit 002a59d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import { createMutation, useQueryClient } from "@tanstack/svelte-query"
import { queryParam } from "sveltekit-search-params"
import { toast } from "svelte-sonner"
import Button from "$lib/components/ui/button/button.svelte"
import { Loader2Icon } from "lucide-svelte"
const deleteRecordId = queryParam("deleteRecordId")
Expand Down Expand Up @@ -61,8 +63,13 @@
>
Cancel
</AlertDialog.Cancel>
<AlertDialog.Action class="text-background bg-red-500 hover:bg-red-600" on:click={onDelete}>
Delete
<AlertDialog.Action asChild>
<Button on:click={onDelete} variant="destructive" disabled={$deleteRecordMutation.isPending}>
{#if $deleteRecordMutation.isPending}
<Loader2Icon class="mr-2 size-3 animate-spin" />
{/if}
Delete
</Button>
</AlertDialog.Action>
</AlertDialog.Footer>
</AlertDialog.Content>
Expand Down

0 comments on commit 002a59d

Please sign in to comment.