From e09ec2b7d5f038869edb5a4c6449ec1dc9508d8a Mon Sep 17 00:00:00 2001 From: Samandar Turgunboyev Date: Wed, 12 Nov 2025 13:53:30 +0500 Subject: [PATCH] put create and delete header-language request uz --- src/pages/tours/ui/StepOne.tsx | 8 ++++++-- src/shared/config/api/httpClient.ts | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pages/tours/ui/StepOne.tsx b/src/pages/tours/ui/StepOne.tsx index 0c0bb68..4e35c24 100644 --- a/src/pages/tours/ui/StepOne.tsx +++ b/src/pages/tours/ui/StepOne.tsx @@ -247,7 +247,7 @@ const StepOne = ({ }, }); - const { mutate: update } = useMutation({ + const { mutate: update, isPending: updatePending } = useMutation({ mutationFn: ({ body, id }: { id: number; body: FormData }) => { return updateTours({ body, id }); }, @@ -2204,7 +2204,11 @@ const StepOne = ({ type="submit" className="mt-6 px-8 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-600 cursor-pointer" > - {isPending ? : t("Saqlash")} + {isPending || updatePending ? ( + + ) : ( + t("Saqlash") + )} diff --git a/src/shared/config/api/httpClient.ts b/src/shared/config/api/httpClient.ts index eff0778..a09a1ca 100644 --- a/src/shared/config/api/httpClient.ts +++ b/src/shared/config/api/httpClient.ts @@ -30,10 +30,14 @@ const httpClient = axios.create({ httpClient.interceptors.request.use( async (config) => { - // Faqat GET so'rovlarida Accept-Language headerini qo'shish - if (config.method?.toLowerCase() === "get") { - const language = i18n.language; - config.headers["Accept-Language"] = language; + const method: string = (config.method || "").toLowerCase(); + + if (method === "get") { + // GET so'rovlarda hozirgi i18n tilini yuboramiz + config.headers["Accept-Language"] = i18n.language; + } else if (["put", "post", "delete"].includes(method)) { + // PUT, POST, DELETE da faqat "uz" + config.headers["Accept-Language"] = "uz"; } const accessToken = getAuthToken();