diff --git a/src/api/parole/services/parole.js b/src/api/parole/services/parole.js index 190b4a1..7ff7a2e 100644 --- a/src/api/parole/services/parole.js +++ b/src/api/parole/services/parole.js @@ -21,14 +21,20 @@ class Translator { target_lang: target, text } - const result = await axios.post(this.urlRequest, qs.stringify(data), { + const result = await axios.post(this.urlRequest, { + text: Array.isArray(text) ? text : [text], + source_lang: origin, + target_lang: target, + }, { headers: { - 'content-type': 'application/x-www-form-urlencoded' + Authorization: `DeepL-Auth-Key ${this.deeplKey}`, + 'Content-Type': 'application/json' } }) return result.data } catch (error) { + console.error('DeepL error:', error?.response?.data || error); console.log('error', error) } }