Comparing version 0.0.19 to 0.0.20
22
index.js
@@ -8,20 +8,12 @@ import axios from 'axios' | ||
init: (cfg) => { | ||
info = cfg | ||
console.log('api cfg: ', info) | ||
const headersInfo ={ | ||
const headersDef = { | ||
// 'Access-Control-Allow-Credentials':'true', | ||
'Accept': 'application/json, text/plain, */*', | ||
'Content-Type': (info.ctype)? info.ctype:'application/json', | ||
'legajo': info.legajo, | ||
'legajoCSG': info.legajoCSG, | ||
'mockmode': info.mockmode, | ||
'isMobile': info.isMobile | ||
'Content-Type': 'application/json' | ||
} | ||
if (info.acao) | ||
headersInfo['Access-Control-Allow-Origin']= info.acao | ||
const headers = {...headersDef, ...cfg.headers} | ||
srv = axios.create({ | ||
baseURL: info.url, | ||
headers: headersInfo | ||
headers: headers | ||
}) | ||
@@ -57,2 +49,5 @@ console.log('API SERVICE initialization srv:', srv) | ||
}, | ||
setHeaders:(headers)=>{ | ||
srv.defaults.headers = {...srv.defaults.headers, ...headers} | ||
}, | ||
setMockFlag: (flag) => { | ||
@@ -69,4 +64,3 @@ delete srv.defaults.headers.mockmode | ||
}, | ||
async sendFile (path, params) { | ||
var formData = new FormData() | ||
sendFile (path, params) { | ||
formData.append("data", params.data) | ||
@@ -73,0 +67,0 @@ |
{ | ||
"name": "fwk-api", | ||
"version": "0.0.19", | ||
"version": "0.0.20", | ||
"description": "Framework with api services access(only javascript)", | ||
@@ -17,4 +17,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
"axios": "^0.23.0" | ||
} | ||
} |
2661
73
+ Addedaxios@0.23.0(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.23.0