put create and delete header-language request uz

This commit is contained in:
Samandar Turgunboyev
2025-11-12 13:53:30 +05:00
parent 64f8467f41
commit e09ec2b7d5
2 changed files with 14 additions and 6 deletions

View File

@@ -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();