bug fix loading

This commit is contained in:
Samandar Turgunboyev
2025-11-11 16:05:22 +05:00
parent 8a4618b454
commit 64f8467f41
11 changed files with 271 additions and 155 deletions

View File

@@ -68,7 +68,7 @@ const Tours = ({ user }: { user: Role }) => {
getAllTours({ page: 1, page_size: 10, featured_tickets: true }),
});
const { mutate } = useMutation({
const { mutate, isPending } = useMutation({
mutationFn: (id: number) => deleteTours({ id }),
onSuccess: () => {
queryClient.refetchQueries({ queryKey: ["all_tours"] });
@@ -270,8 +270,14 @@ const Tours = ({ user }: { user: Role }) => {
variant="destructive"
onClick={() => confirmDelete(deleteId!)}
>
<Trash2 className="w-4 h-4 mr-2" />
{t("O'chirish")}
{isPending ? (
<Loader2 className="animate-spin" />
) : (
<>
<Trash2 className="w-4 h-4 mr-2" />
{t("O'chirish")}
</>
)}
</Button>
</DialogFooter>
</DialogContent>