aloha-vue 1.0.246 → 1.0.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ const BASE_URL = ref("/api/");
|
|
|
17
17
|
const API = ref(axios.create());
|
|
18
18
|
const API_SAVED = ref({});
|
|
19
19
|
const ERROR_CALLBACKS = ref({});
|
|
20
|
+
const HEADER_PARAMS = ref({});
|
|
20
21
|
|
|
21
22
|
export function create({ axiosCreateOptions = {} }) {
|
|
22
23
|
API.value = axios.create(axiosCreateOptions);
|
|
@@ -30,6 +31,10 @@ export function setErrorCallbacks({ errorCallbacks = {} }) {
|
|
|
30
31
|
ERROR_CALLBACKS.value = errorCallbacks;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
export function setHeaderParams({ headerParams = {} } = {}) {
|
|
35
|
+
HEADER_PARAMS.value = headerParams;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
export default function AHttpAPI() {
|
|
34
39
|
return {
|
|
35
40
|
deleteHttp,
|
|
@@ -205,7 +210,7 @@ export function callHttpRequestAndCheckSavedApi({
|
|
|
205
210
|
url,
|
|
206
211
|
urlParams,
|
|
207
212
|
data,
|
|
208
|
-
headerParams,
|
|
213
|
+
headerParams = {},
|
|
209
214
|
responseType = "json",
|
|
210
215
|
apiSaveId,
|
|
211
216
|
keyId,
|
|
@@ -240,11 +245,15 @@ export function callHttpRequestAndCheckSavedApi({
|
|
|
240
245
|
const URL_NEW = setUrlWithParams({ url, params: urlParams });
|
|
241
246
|
let url_full = `${ BASE_URL.value }${ URL_NEW }`;
|
|
242
247
|
url_full = url_full.replace(/\/\//g, "/");
|
|
248
|
+
const HEADER_PARAMS_LOCAL = {
|
|
249
|
+
...HEADER_PARAMS.value,
|
|
250
|
+
...headerParams,
|
|
251
|
+
};
|
|
243
252
|
API.value({
|
|
244
253
|
method: methodHttp,
|
|
245
254
|
url: url_full,
|
|
246
255
|
data,
|
|
247
|
-
headers:
|
|
256
|
+
headers: HEADER_PARAMS_LOCAL,
|
|
248
257
|
responseType,
|
|
249
258
|
}).then(
|
|
250
259
|
response => {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
create,
|
|
3
|
-
setBaseUrl,
|
|
3
|
+
setBaseUrl,
|
|
4
|
+
setErrorCallbacks,
|
|
5
|
+
setHeaderParams,
|
|
4
6
|
} from "../compositionAPI/AHttpAPI";
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
|
-
install: (app, { axiosCreateOptions = {}, baseUrl = "/api/", errorCallbacks = {} } = {}) => {
|
|
9
|
+
install: (app, { axiosCreateOptions = {}, baseUrl = "/api/", errorCallbacks = {}, headerParams = {} } = {}) => {
|
|
8
10
|
create({ axiosCreateOptions });
|
|
9
11
|
setBaseUrl({ baseUrl });
|
|
10
12
|
setErrorCallbacks({ errorCallbacks });
|
|
13
|
+
setHeaderParams({ headerParams });
|
|
11
14
|
},
|
|
12
15
|
};
|