bug fix loading
This commit is contained in:
@@ -35,7 +35,7 @@ import { RadioGroup, RadioGroupItem } from "@/shared/ui/radio-group";
|
||||
import { Textarea } from "@/shared/ui/textarea";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { ChevronDownIcon, SquareCheckBig, XIcon } from "lucide-react";
|
||||
import { ChevronDownIcon, Loader2, SquareCheckBig, XIcon } from "lucide-react";
|
||||
import { useEffect, useState, type Dispatch, type SetStateAction } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -231,7 +231,7 @@ const StepOne = ({
|
||||
const selectedDate = watch("departureDateTime.date");
|
||||
const selectedDateTravel = watch("travelDateTime.date");
|
||||
|
||||
const { mutate: create } = useMutation({
|
||||
const { mutate: create, isPending } = useMutation({
|
||||
mutationFn: (body: FormData) => {
|
||||
return createTours({ body });
|
||||
},
|
||||
@@ -2204,7 +2204,7 @@ const StepOne = ({
|
||||
type="submit"
|
||||
className="mt-6 px-8 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-600 cursor-pointer"
|
||||
>
|
||||
{t("Saqlash")}
|
||||
{isPending ? <Loader2 className="animate-spin" /> : t("Saqlash")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user