From 55958a77fd4a19f97cb63df079538932003202e1 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 30 Jun 2026 10:54:16 +0300 Subject: [PATCH] Fix doc upload --- src/services/laravelApiService.js | 8 ++++++-- src/shared/api/deal.js | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/services/laravelApiService.js b/src/services/laravelApiService.js index 07f7b9d..905831c 100644 --- a/src/services/laravelApiService.js +++ b/src/services/laravelApiService.js @@ -14,7 +14,7 @@ const fetchData = (endpoint, options = {}) => { } // Деструктурируем headers из options - const { method = 'GET', data, params = {}, headers = {} } = options; + const { method = 'GET', data, params = {}, headers = {}, forceProxy = false } = options; // Получаем PHPSESSID const isDev = import.meta.env.MODE === 'development'; @@ -32,7 +32,7 @@ const fetchData = (endpoint, options = {}) => { // console.log('[laravelApiService] data instanceof FormData:', data instanceof FormData); const isFormData = data instanceof FormData; - if (isFormData) { + if (isFormData && !forceProxy) { //console.log('[laravelApiService] Используем directAxiosInstance для FormData'); const laravelApiUrl = import.meta.env.VITE_LARAVEL_URL || 'https://api.joywork.ru/api'; @@ -63,6 +63,10 @@ const fetchData = (endpoint, options = {}) => { finalHeaders['X-Session-ID'] = sessionId; } + if (isFormData) { + finalHeaders['Content-Type'] = undefined; + } + return laravel_api_instance({ url: '/deal/index.php', method, diff --git a/src/shared/api/deal.js b/src/shared/api/deal.js index d13a2b2..8b93b09 100644 --- a/src/shared/api/deal.js +++ b/src/shared/api/deal.js @@ -32,9 +32,7 @@ export const dealsApi = { return laravelApi.fetchData('/documents', { method: 'POST', data: formData, - // headers: { - // 'Content-Type': 'multipart/form-data', // Важно для FormData! - // }, + forceProxy: true, }); },