put create and delete header-language request uz
This commit is contained in:
@@ -247,7 +247,7 @@ const StepOne = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { mutate: update } = useMutation({
|
const { mutate: update, isPending: updatePending } = useMutation({
|
||||||
mutationFn: ({ body, id }: { id: number; body: FormData }) => {
|
mutationFn: ({ body, id }: { id: number; body: FormData }) => {
|
||||||
return updateTours({ body, id });
|
return updateTours({ body, id });
|
||||||
},
|
},
|
||||||
@@ -2204,7 +2204,11 @@ const StepOne = ({
|
|||||||
type="submit"
|
type="submit"
|
||||||
className="mt-6 px-8 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-600 cursor-pointer"
|
className="mt-6 px-8 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-600 cursor-pointer"
|
||||||
>
|
>
|
||||||
{isPending ? <Loader2 className="animate-spin" /> : t("Saqlash")}
|
{isPending || updatePending ? (
|
||||||
|
<Loader2 className="animate-spin" />
|
||||||
|
) : (
|
||||||
|
t("Saqlash")
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -30,10 +30,14 @@ const httpClient = axios.create({
|
|||||||
|
|
||||||
httpClient.interceptors.request.use(
|
httpClient.interceptors.request.use(
|
||||||
async (config) => {
|
async (config) => {
|
||||||
// Faqat GET so'rovlarida Accept-Language headerini qo'shish
|
const method: string = (config.method || "").toLowerCase();
|
||||||
if (config.method?.toLowerCase() === "get") {
|
|
||||||
const language = i18n.language;
|
if (method === "get") {
|
||||||
config.headers["Accept-Language"] = language;
|
// 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();
|
const accessToken = getAuthToken();
|
||||||
|
|||||||
Reference in New Issue
Block a user