axios 0.17.1 → 0.19.0
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.
Potentially problematic release.
This version of axios might be problematic. Click here for more details.
- package/CHANGELOG.md +114 -0
- package/LICENSE +1 -1
- package/README.md +102 -30
- package/dist/axios.js +615 -548
- package/dist/axios.map +1 -1
- package/dist/axios.min.js +4 -4
- package/dist/axios.min.map +1 -1
- package/index.d.ts +40 -15
- package/lib/adapters/http.js +77 -30
- package/lib/adapters/xhr.js +18 -24
- package/lib/axios.js +2 -1
- package/lib/core/Axios.js +13 -6
- package/lib/core/enhanceError.js +21 -0
- package/lib/core/mergeConfig.js +51 -0
- package/lib/core/settle.js +1 -2
- package/lib/defaults.js +10 -4
- package/lib/helpers/buildURL.js +6 -3
- package/lib/helpers/cookies.js +41 -41
- package/lib/helpers/isURLSameOrigin.js +38 -38
- package/lib/utils.js +32 -1
- package/package.json +23 -23
- package/lib/helpers/btoa.js +0 -36
package/dist/axios.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* axios v0.
|
1
|
+
/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
4
4
|
module.exports = factory();
|
@@ -66,7 +66,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
66
66
|
var utils = __webpack_require__(2);
|
67
67
|
var bind = __webpack_require__(3);
|
68
68
|
var Axios = __webpack_require__(5);
|
69
|
-
var
|
69
|
+
var mergeConfig = __webpack_require__(22);
|
70
|
+
var defaults = __webpack_require__(11);
|
70
71
|
|
71
72
|
/**
|
72
73
|
* Create an instance of Axios
|
@@ -95,13 +96,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
95
96
|
|
96
97
|
// Factory for creating new instances
|
97
98
|
axios.create = function create(instanceConfig) {
|
98
|
-
return createInstance(
|
99
|
+
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
99
100
|
};
|
100
101
|
|
101
102
|
// Expose Cancel & CancelToken
|
102
103
|
axios.Cancel = __webpack_require__(23);
|
103
104
|
axios.CancelToken = __webpack_require__(24);
|
104
|
-
axios.isCancel = __webpack_require__(
|
105
|
+
axios.isCancel = __webpack_require__(10);
|
105
106
|
|
106
107
|
// Expose all/spread
|
107
108
|
axios.all = function all(promises) {
|
@@ -298,9 +299,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
298
299
|
*
|
299
300
|
* react-native:
|
300
301
|
* navigator.product -> 'ReactNative'
|
302
|
+
* nativescript
|
303
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
301
304
|
*/
|
302
305
|
function isStandardBrowserEnv() {
|
303
|
-
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative'
|
306
|
+
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
307
|
+
navigator.product === 'NativeScript' ||
|
308
|
+
navigator.product === 'NS')) {
|
304
309
|
return false;
|
305
310
|
}
|
306
311
|
return (
|
@@ -381,6 +386,32 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
381
386
|
return result;
|
382
387
|
}
|
383
388
|
|
389
|
+
/**
|
390
|
+
* Function equal to merge with the difference being that no reference
|
391
|
+
* to original objects is kept.
|
392
|
+
*
|
393
|
+
* @see merge
|
394
|
+
* @param {Object} obj1 Object to merge
|
395
|
+
* @returns {Object} Result of all merge properties
|
396
|
+
*/
|
397
|
+
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
398
|
+
var result = {};
|
399
|
+
function assignValue(val, key) {
|
400
|
+
if (typeof result[key] === 'object' && typeof val === 'object') {
|
401
|
+
result[key] = deepMerge(result[key], val);
|
402
|
+
} else if (typeof val === 'object') {
|
403
|
+
result[key] = deepMerge({}, val);
|
404
|
+
} else {
|
405
|
+
result[key] = val;
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
410
|
+
forEach(arguments[i], assignValue);
|
411
|
+
}
|
412
|
+
return result;
|
413
|
+
}
|
414
|
+
|
384
415
|
/**
|
385
416
|
* Extends object a by mutably adding to it the properties of object b.
|
386
417
|
*
|
@@ -419,6 +450,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
419
450
|
isStandardBrowserEnv: isStandardBrowserEnv,
|
420
451
|
forEach: forEach,
|
421
452
|
merge: merge,
|
453
|
+
deepMerge: deepMerge,
|
422
454
|
extend: extend,
|
423
455
|
trim: trim
|
424
456
|
};
|
@@ -448,23 +480,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
448
480
|
/*!
|
449
481
|
* Determine if an object is a Buffer
|
450
482
|
*
|
451
|
-
* @author Feross Aboukhadijeh <
|
483
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
452
484
|
* @license MIT
|
453
485
|
*/
|
454
486
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
|
459
|
-
}
|
460
|
-
|
461
|
-
function isBuffer (obj) {
|
462
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
463
|
-
}
|
464
|
-
|
465
|
-
// For Node v0.10 support. Remove this eventually.
|
466
|
-
function isSlowBuffer (obj) {
|
467
|
-
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
487
|
+
module.exports = function isBuffer (obj) {
|
488
|
+
return obj != null && obj.constructor != null &&
|
489
|
+
typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
468
490
|
}
|
469
491
|
|
470
492
|
|
@@ -474,10 +496,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
474
496
|
|
475
497
|
'use strict';
|
476
498
|
|
477
|
-
var defaults = __webpack_require__(6);
|
478
499
|
var utils = __webpack_require__(2);
|
479
|
-
var
|
480
|
-
var
|
500
|
+
var buildURL = __webpack_require__(6);
|
501
|
+
var InterceptorManager = __webpack_require__(7);
|
502
|
+
var dispatchRequest = __webpack_require__(8);
|
503
|
+
var mergeConfig = __webpack_require__(22);
|
481
504
|
|
482
505
|
/**
|
483
506
|
* Create a new instance of Axios
|
@@ -501,13 +524,14 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
501
524
|
/*eslint no-param-reassign:0*/
|
502
525
|
// Allow for axios('example/url'[, config]) a la fetch API
|
503
526
|
if (typeof config === 'string') {
|
504
|
-
config =
|
505
|
-
|
506
|
-
|
527
|
+
config = arguments[1] || {};
|
528
|
+
config.url = arguments[0];
|
529
|
+
} else {
|
530
|
+
config = config || {};
|
507
531
|
}
|
508
532
|
|
509
|
-
config =
|
510
|
-
config.method = config.method.toLowerCase();
|
533
|
+
config = mergeConfig(this.defaults, config);
|
534
|
+
config.method = config.method ? config.method.toLowerCase() : 'get';
|
511
535
|
|
512
536
|
// Hook up interceptors middleware
|
513
537
|
var chain = [dispatchRequest, undefined];
|
@@ -528,6 +552,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
528
552
|
return promise;
|
529
553
|
};
|
530
554
|
|
555
|
+
Axios.prototype.getUri = function getUri(config) {
|
556
|
+
config = mergeConfig(this.defaults, config);
|
557
|
+
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
558
|
+
};
|
559
|
+
|
531
560
|
// Provide aliases for supported request methods
|
532
561
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
533
562
|
/*eslint func-names:0*/
|
@@ -560,95 +589,74 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
560
589
|
'use strict';
|
561
590
|
|
562
591
|
var utils = __webpack_require__(2);
|
563
|
-
var normalizeHeaderName = __webpack_require__(7);
|
564
|
-
|
565
|
-
var DEFAULT_CONTENT_TYPE = {
|
566
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
567
|
-
};
|
568
592
|
|
569
|
-
function
|
570
|
-
|
571
|
-
|
572
|
-
|
593
|
+
function encode(val) {
|
594
|
+
return encodeURIComponent(val).
|
595
|
+
replace(/%40/gi, '@').
|
596
|
+
replace(/%3A/gi, ':').
|
597
|
+
replace(/%24/g, '$').
|
598
|
+
replace(/%2C/gi, ',').
|
599
|
+
replace(/%20/g, '+').
|
600
|
+
replace(/%5B/gi, '[').
|
601
|
+
replace(/%5D/gi, ']');
|
573
602
|
}
|
574
603
|
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
604
|
+
/**
|
605
|
+
* Build a URL by appending params to the end
|
606
|
+
*
|
607
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
608
|
+
* @param {object} [params] The params to be appended
|
609
|
+
* @returns {string} The formatted url
|
610
|
+
*/
|
611
|
+
module.exports = function buildURL(url, params, paramsSerializer) {
|
612
|
+
/*eslint no-param-reassign:0*/
|
613
|
+
if (!params) {
|
614
|
+
return url;
|
583
615
|
}
|
584
|
-
return adapter;
|
585
|
-
}
|
586
616
|
|
587
|
-
|
588
|
-
|
617
|
+
var serializedParams;
|
618
|
+
if (paramsSerializer) {
|
619
|
+
serializedParams = paramsSerializer(params);
|
620
|
+
} else if (utils.isURLSearchParams(params)) {
|
621
|
+
serializedParams = params.toString();
|
622
|
+
} else {
|
623
|
+
var parts = [];
|
589
624
|
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
utils.isBuffer(data) ||
|
595
|
-
utils.isStream(data) ||
|
596
|
-
utils.isFile(data) ||
|
597
|
-
utils.isBlob(data)
|
598
|
-
) {
|
599
|
-
return data;
|
600
|
-
}
|
601
|
-
if (utils.isArrayBufferView(data)) {
|
602
|
-
return data.buffer;
|
603
|
-
}
|
604
|
-
if (utils.isURLSearchParams(data)) {
|
605
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
606
|
-
return data.toString();
|
607
|
-
}
|
608
|
-
if (utils.isObject(data)) {
|
609
|
-
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
610
|
-
return JSON.stringify(data);
|
611
|
-
}
|
612
|
-
return data;
|
613
|
-
}],
|
625
|
+
utils.forEach(params, function serialize(val, key) {
|
626
|
+
if (val === null || typeof val === 'undefined') {
|
627
|
+
return;
|
628
|
+
}
|
614
629
|
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
} catch (e) { /* Ignore */ }
|
621
|
-
}
|
622
|
-
return data;
|
623
|
-
}],
|
630
|
+
if (utils.isArray(val)) {
|
631
|
+
key = key + '[]';
|
632
|
+
} else {
|
633
|
+
val = [val];
|
634
|
+
}
|
624
635
|
|
625
|
-
|
636
|
+
utils.forEach(val, function parseValue(v) {
|
637
|
+
if (utils.isDate(v)) {
|
638
|
+
v = v.toISOString();
|
639
|
+
} else if (utils.isObject(v)) {
|
640
|
+
v = JSON.stringify(v);
|
641
|
+
}
|
642
|
+
parts.push(encode(key) + '=' + encode(v));
|
643
|
+
});
|
644
|
+
});
|
626
645
|
|
627
|
-
|
628
|
-
|
646
|
+
serializedParams = parts.join('&');
|
647
|
+
}
|
629
648
|
|
630
|
-
|
649
|
+
if (serializedParams) {
|
650
|
+
var hashmarkIndex = url.indexOf('#');
|
651
|
+
if (hashmarkIndex !== -1) {
|
652
|
+
url = url.slice(0, hashmarkIndex);
|
653
|
+
}
|
631
654
|
|
632
|
-
|
633
|
-
return status >= 200 && status < 300;
|
655
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
634
656
|
}
|
635
|
-
};
|
636
657
|
|
637
|
-
|
638
|
-
common: {
|
639
|
-
'Accept': 'application/json, text/plain, */*'
|
640
|
-
}
|
658
|
+
return url;
|
641
659
|
};
|
642
|
-
|
643
|
-
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
644
|
-
defaults.headers[method] = {};
|
645
|
-
});
|
646
|
-
|
647
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
648
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
649
|
-
});
|
650
|
-
|
651
|
-
module.exports = defaults;
|
652
660
|
|
653
661
|
|
654
662
|
/***/ }),
|
@@ -659,14 +667,54 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
659
667
|
|
660
668
|
var utils = __webpack_require__(2);
|
661
669
|
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
670
|
+
function InterceptorManager() {
|
671
|
+
this.handlers = [];
|
672
|
+
}
|
673
|
+
|
674
|
+
/**
|
675
|
+
* Add a new interceptor to the stack
|
676
|
+
*
|
677
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
678
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
679
|
+
*
|
680
|
+
* @return {Number} An ID used to remove interceptor later
|
681
|
+
*/
|
682
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
683
|
+
this.handlers.push({
|
684
|
+
fulfilled: fulfilled,
|
685
|
+
rejected: rejected
|
686
|
+
});
|
687
|
+
return this.handlers.length - 1;
|
688
|
+
};
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Remove an interceptor from the stack
|
692
|
+
*
|
693
|
+
* @param {Number} id The ID that was returned by `use`
|
694
|
+
*/
|
695
|
+
InterceptorManager.prototype.eject = function eject(id) {
|
696
|
+
if (this.handlers[id]) {
|
697
|
+
this.handlers[id] = null;
|
698
|
+
}
|
699
|
+
};
|
700
|
+
|
701
|
+
/**
|
702
|
+
* Iterate over all the registered interceptors
|
703
|
+
*
|
704
|
+
* This method is particularly useful for skipping over any
|
705
|
+
* interceptors that may have become `null` calling `eject`.
|
706
|
+
*
|
707
|
+
* @param {Function} fn The function to call for each interceptor
|
708
|
+
*/
|
709
|
+
InterceptorManager.prototype.forEach = function forEach(fn) {
|
710
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
711
|
+
if (h !== null) {
|
712
|
+
fn(h);
|
667
713
|
}
|
668
714
|
});
|
669
715
|
};
|
716
|
+
|
717
|
+
module.exports = InterceptorManager;
|
670
718
|
|
671
719
|
|
672
720
|
/***/ }),
|
@@ -676,61 +724,295 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
676
724
|
'use strict';
|
677
725
|
|
678
726
|
var utils = __webpack_require__(2);
|
679
|
-
var
|
680
|
-
var
|
681
|
-
var
|
682
|
-
var
|
683
|
-
var
|
684
|
-
var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(15);
|
685
|
-
|
686
|
-
module.exports = function xhrAdapter(config) {
|
687
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
688
|
-
var requestData = config.data;
|
689
|
-
var requestHeaders = config.headers;
|
727
|
+
var transformData = __webpack_require__(9);
|
728
|
+
var isCancel = __webpack_require__(10);
|
729
|
+
var defaults = __webpack_require__(11);
|
730
|
+
var isAbsoluteURL = __webpack_require__(20);
|
731
|
+
var combineURLs = __webpack_require__(21);
|
690
732
|
|
691
|
-
|
692
|
-
|
693
|
-
|
733
|
+
/**
|
734
|
+
* Throws a `Cancel` if cancellation has been requested.
|
735
|
+
*/
|
736
|
+
function throwIfCancellationRequested(config) {
|
737
|
+
if (config.cancelToken) {
|
738
|
+
config.cancelToken.throwIfRequested();
|
739
|
+
}
|
740
|
+
}
|
694
741
|
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
typeof window !== 'undefined' &&
|
704
|
-
window.XDomainRequest && !('withCredentials' in request) &&
|
705
|
-
!isURLSameOrigin(config.url)) {
|
706
|
-
request = new window.XDomainRequest();
|
707
|
-
loadEvent = 'onload';
|
708
|
-
xDomain = true;
|
709
|
-
request.onprogress = function handleProgress() {};
|
710
|
-
request.ontimeout = function handleTimeout() {};
|
711
|
-
}
|
742
|
+
/**
|
743
|
+
* Dispatch a request to the server using the configured adapter.
|
744
|
+
*
|
745
|
+
* @param {object} config The config that is to be used for the request
|
746
|
+
* @returns {Promise} The Promise to be fulfilled
|
747
|
+
*/
|
748
|
+
module.exports = function dispatchRequest(config) {
|
749
|
+
throwIfCancellationRequested(config);
|
712
750
|
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
718
|
-
}
|
751
|
+
// Support baseURL config
|
752
|
+
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
753
|
+
config.url = combineURLs(config.baseURL, config.url);
|
754
|
+
}
|
719
755
|
|
720
|
-
|
756
|
+
// Ensure headers exist
|
757
|
+
config.headers = config.headers || {};
|
721
758
|
|
722
|
-
|
723
|
-
|
759
|
+
// Transform request data
|
760
|
+
config.data = transformData(
|
761
|
+
config.data,
|
762
|
+
config.headers,
|
763
|
+
config.transformRequest
|
764
|
+
);
|
724
765
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
766
|
+
// Flatten headers
|
767
|
+
config.headers = utils.merge(
|
768
|
+
config.headers.common || {},
|
769
|
+
config.headers[config.method] || {},
|
770
|
+
config.headers || {}
|
771
|
+
);
|
730
772
|
|
731
|
-
|
732
|
-
|
733
|
-
|
773
|
+
utils.forEach(
|
774
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
775
|
+
function cleanHeaderConfig(method) {
|
776
|
+
delete config.headers[method];
|
777
|
+
}
|
778
|
+
);
|
779
|
+
|
780
|
+
var adapter = config.adapter || defaults.adapter;
|
781
|
+
|
782
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
783
|
+
throwIfCancellationRequested(config);
|
784
|
+
|
785
|
+
// Transform response data
|
786
|
+
response.data = transformData(
|
787
|
+
response.data,
|
788
|
+
response.headers,
|
789
|
+
config.transformResponse
|
790
|
+
);
|
791
|
+
|
792
|
+
return response;
|
793
|
+
}, function onAdapterRejection(reason) {
|
794
|
+
if (!isCancel(reason)) {
|
795
|
+
throwIfCancellationRequested(config);
|
796
|
+
|
797
|
+
// Transform response data
|
798
|
+
if (reason && reason.response) {
|
799
|
+
reason.response.data = transformData(
|
800
|
+
reason.response.data,
|
801
|
+
reason.response.headers,
|
802
|
+
config.transformResponse
|
803
|
+
);
|
804
|
+
}
|
805
|
+
}
|
806
|
+
|
807
|
+
return Promise.reject(reason);
|
808
|
+
});
|
809
|
+
};
|
810
|
+
|
811
|
+
|
812
|
+
/***/ }),
|
813
|
+
/* 9 */
|
814
|
+
/***/ (function(module, exports, __webpack_require__) {
|
815
|
+
|
816
|
+
'use strict';
|
817
|
+
|
818
|
+
var utils = __webpack_require__(2);
|
819
|
+
|
820
|
+
/**
|
821
|
+
* Transform the data for a request or a response
|
822
|
+
*
|
823
|
+
* @param {Object|String} data The data to be transformed
|
824
|
+
* @param {Array} headers The headers for the request or response
|
825
|
+
* @param {Array|Function} fns A single function or Array of functions
|
826
|
+
* @returns {*} The resulting transformed data
|
827
|
+
*/
|
828
|
+
module.exports = function transformData(data, headers, fns) {
|
829
|
+
/*eslint no-param-reassign:0*/
|
830
|
+
utils.forEach(fns, function transform(fn) {
|
831
|
+
data = fn(data, headers);
|
832
|
+
});
|
833
|
+
|
834
|
+
return data;
|
835
|
+
};
|
836
|
+
|
837
|
+
|
838
|
+
/***/ }),
|
839
|
+
/* 10 */
|
840
|
+
/***/ (function(module, exports) {
|
841
|
+
|
842
|
+
'use strict';
|
843
|
+
|
844
|
+
module.exports = function isCancel(value) {
|
845
|
+
return !!(value && value.__CANCEL__);
|
846
|
+
};
|
847
|
+
|
848
|
+
|
849
|
+
/***/ }),
|
850
|
+
/* 11 */
|
851
|
+
/***/ (function(module, exports, __webpack_require__) {
|
852
|
+
|
853
|
+
'use strict';
|
854
|
+
|
855
|
+
var utils = __webpack_require__(2);
|
856
|
+
var normalizeHeaderName = __webpack_require__(12);
|
857
|
+
|
858
|
+
var DEFAULT_CONTENT_TYPE = {
|
859
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
860
|
+
};
|
861
|
+
|
862
|
+
function setContentTypeIfUnset(headers, value) {
|
863
|
+
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
864
|
+
headers['Content-Type'] = value;
|
865
|
+
}
|
866
|
+
}
|
867
|
+
|
868
|
+
function getDefaultAdapter() {
|
869
|
+
var adapter;
|
870
|
+
// Only Node.JS has a process variable that is of [[Class]] process
|
871
|
+
if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
872
|
+
// For node use HTTP adapter
|
873
|
+
adapter = __webpack_require__(13);
|
874
|
+
} else if (typeof XMLHttpRequest !== 'undefined') {
|
875
|
+
// For browsers use XHR adapter
|
876
|
+
adapter = __webpack_require__(13);
|
877
|
+
}
|
878
|
+
return adapter;
|
879
|
+
}
|
880
|
+
|
881
|
+
var defaults = {
|
882
|
+
adapter: getDefaultAdapter(),
|
883
|
+
|
884
|
+
transformRequest: [function transformRequest(data, headers) {
|
885
|
+
normalizeHeaderName(headers, 'Accept');
|
886
|
+
normalizeHeaderName(headers, 'Content-Type');
|
887
|
+
if (utils.isFormData(data) ||
|
888
|
+
utils.isArrayBuffer(data) ||
|
889
|
+
utils.isBuffer(data) ||
|
890
|
+
utils.isStream(data) ||
|
891
|
+
utils.isFile(data) ||
|
892
|
+
utils.isBlob(data)
|
893
|
+
) {
|
894
|
+
return data;
|
895
|
+
}
|
896
|
+
if (utils.isArrayBufferView(data)) {
|
897
|
+
return data.buffer;
|
898
|
+
}
|
899
|
+
if (utils.isURLSearchParams(data)) {
|
900
|
+
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
901
|
+
return data.toString();
|
902
|
+
}
|
903
|
+
if (utils.isObject(data)) {
|
904
|
+
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
905
|
+
return JSON.stringify(data);
|
906
|
+
}
|
907
|
+
return data;
|
908
|
+
}],
|
909
|
+
|
910
|
+
transformResponse: [function transformResponse(data) {
|
911
|
+
/*eslint no-param-reassign:0*/
|
912
|
+
if (typeof data === 'string') {
|
913
|
+
try {
|
914
|
+
data = JSON.parse(data);
|
915
|
+
} catch (e) { /* Ignore */ }
|
916
|
+
}
|
917
|
+
return data;
|
918
|
+
}],
|
919
|
+
|
920
|
+
/**
|
921
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
922
|
+
* timeout is not created.
|
923
|
+
*/
|
924
|
+
timeout: 0,
|
925
|
+
|
926
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
927
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
928
|
+
|
929
|
+
maxContentLength: -1,
|
930
|
+
|
931
|
+
validateStatus: function validateStatus(status) {
|
932
|
+
return status >= 200 && status < 300;
|
933
|
+
}
|
934
|
+
};
|
935
|
+
|
936
|
+
defaults.headers = {
|
937
|
+
common: {
|
938
|
+
'Accept': 'application/json, text/plain, */*'
|
939
|
+
}
|
940
|
+
};
|
941
|
+
|
942
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
943
|
+
defaults.headers[method] = {};
|
944
|
+
});
|
945
|
+
|
946
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
947
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
948
|
+
});
|
949
|
+
|
950
|
+
module.exports = defaults;
|
951
|
+
|
952
|
+
|
953
|
+
/***/ }),
|
954
|
+
/* 12 */
|
955
|
+
/***/ (function(module, exports, __webpack_require__) {
|
956
|
+
|
957
|
+
'use strict';
|
958
|
+
|
959
|
+
var utils = __webpack_require__(2);
|
960
|
+
|
961
|
+
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
962
|
+
utils.forEach(headers, function processHeader(value, name) {
|
963
|
+
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
964
|
+
headers[normalizedName] = value;
|
965
|
+
delete headers[name];
|
966
|
+
}
|
967
|
+
});
|
968
|
+
};
|
969
|
+
|
970
|
+
|
971
|
+
/***/ }),
|
972
|
+
/* 13 */
|
973
|
+
/***/ (function(module, exports, __webpack_require__) {
|
974
|
+
|
975
|
+
'use strict';
|
976
|
+
|
977
|
+
var utils = __webpack_require__(2);
|
978
|
+
var settle = __webpack_require__(14);
|
979
|
+
var buildURL = __webpack_require__(6);
|
980
|
+
var parseHeaders = __webpack_require__(17);
|
981
|
+
var isURLSameOrigin = __webpack_require__(18);
|
982
|
+
var createError = __webpack_require__(15);
|
983
|
+
|
984
|
+
module.exports = function xhrAdapter(config) {
|
985
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
986
|
+
var requestData = config.data;
|
987
|
+
var requestHeaders = config.headers;
|
988
|
+
|
989
|
+
if (utils.isFormData(requestData)) {
|
990
|
+
delete requestHeaders['Content-Type']; // Let the browser set it
|
991
|
+
}
|
992
|
+
|
993
|
+
var request = new XMLHttpRequest();
|
994
|
+
|
995
|
+
// HTTP basic authentication
|
996
|
+
if (config.auth) {
|
997
|
+
var username = config.auth.username || '';
|
998
|
+
var password = config.auth.password || '';
|
999
|
+
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
|
1003
|
+
|
1004
|
+
// Set the request timeout in MS
|
1005
|
+
request.timeout = config.timeout;
|
1006
|
+
|
1007
|
+
// Listen for ready state
|
1008
|
+
request.onreadystatechange = function handleLoad() {
|
1009
|
+
if (!request || request.readyState !== 4) {
|
1010
|
+
return;
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
// The request errored out and we didn't get a response, this will be
|
1014
|
+
// handled by onerror instead
|
1015
|
+
// With one exception: request that using file: protocol, most browsers
|
734
1016
|
// will return status as 0 even though it's a successful request
|
735
1017
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
736
1018
|
return;
|
@@ -741,9 +1023,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
741
1023
|
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
742
1024
|
var response = {
|
743
1025
|
data: responseData,
|
744
|
-
|
745
|
-
|
746
|
-
statusText: request.status === 1223 ? 'No Content' : request.statusText,
|
1026
|
+
status: request.status,
|
1027
|
+
statusText: request.statusText,
|
747
1028
|
headers: responseHeaders,
|
748
1029
|
config: config,
|
749
1030
|
request: request
|
@@ -755,6 +1036,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
755
1036
|
request = null;
|
756
1037
|
};
|
757
1038
|
|
1039
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
1040
|
+
request.onabort = function handleAbort() {
|
1041
|
+
if (!request) {
|
1042
|
+
return;
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
1046
|
+
|
1047
|
+
// Clean up request
|
1048
|
+
request = null;
|
1049
|
+
};
|
1050
|
+
|
758
1051
|
// Handle low level network errors
|
759
1052
|
request.onerror = function handleError() {
|
760
1053
|
// Real errors are hidden from us by the browser
|
@@ -778,12 +1071,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
778
1071
|
// This is only done if running in a standard browser environment.
|
779
1072
|
// Specifically not if we're in a web worker, or react-native.
|
780
1073
|
if (utils.isStandardBrowserEnv()) {
|
781
|
-
var cookies = __webpack_require__(
|
1074
|
+
var cookies = __webpack_require__(19);
|
782
1075
|
|
783
1076
|
// Add xsrf header
|
784
1077
|
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
|
785
|
-
|
786
|
-
|
1078
|
+
cookies.read(config.xsrfCookieName) :
|
1079
|
+
undefined;
|
787
1080
|
|
788
1081
|
if (xsrfValue) {
|
789
1082
|
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
@@ -856,12 +1149,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
856
1149
|
|
857
1150
|
|
858
1151
|
/***/ }),
|
859
|
-
/*
|
1152
|
+
/* 14 */
|
860
1153
|
/***/ (function(module, exports, __webpack_require__) {
|
861
1154
|
|
862
1155
|
'use strict';
|
863
1156
|
|
864
|
-
var createError = __webpack_require__(
|
1157
|
+
var createError = __webpack_require__(15);
|
865
1158
|
|
866
1159
|
/**
|
867
1160
|
* Resolve or reject a Promise based on response status.
|
@@ -872,8 +1165,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
872
1165
|
*/
|
873
1166
|
module.exports = function settle(resolve, reject, response) {
|
874
1167
|
var validateStatus = response.config.validateStatus;
|
875
|
-
|
876
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
1168
|
+
if (!validateStatus || validateStatus(response.status)) {
|
877
1169
|
resolve(response);
|
878
1170
|
} else {
|
879
1171
|
reject(createError(
|
@@ -888,12 +1180,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
888
1180
|
|
889
1181
|
|
890
1182
|
/***/ }),
|
891
|
-
/*
|
1183
|
+
/* 15 */
|
892
1184
|
/***/ (function(module, exports, __webpack_require__) {
|
893
1185
|
|
894
1186
|
'use strict';
|
895
1187
|
|
896
|
-
var enhanceError = __webpack_require__(
|
1188
|
+
var enhanceError = __webpack_require__(16);
|
897
1189
|
|
898
1190
|
/**
|
899
1191
|
* Create an Error with the specified message, config, error code, request and response.
|
@@ -912,7 +1204,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
912
1204
|
|
913
1205
|
|
914
1206
|
/***/ }),
|
915
|
-
/*
|
1207
|
+
/* 16 */
|
916
1208
|
/***/ (function(module, exports) {
|
917
1209
|
|
918
1210
|
'use strict';
|
@@ -932,88 +1224,35 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
932
1224
|
if (code) {
|
933
1225
|
error.code = code;
|
934
1226
|
}
|
1227
|
+
|
935
1228
|
error.request = request;
|
936
1229
|
error.response = response;
|
1230
|
+
error.isAxiosError = true;
|
1231
|
+
|
1232
|
+
error.toJSON = function() {
|
1233
|
+
return {
|
1234
|
+
// Standard
|
1235
|
+
message: this.message,
|
1236
|
+
name: this.name,
|
1237
|
+
// Microsoft
|
1238
|
+
description: this.description,
|
1239
|
+
number: this.number,
|
1240
|
+
// Mozilla
|
1241
|
+
fileName: this.fileName,
|
1242
|
+
lineNumber: this.lineNumber,
|
1243
|
+
columnNumber: this.columnNumber,
|
1244
|
+
stack: this.stack,
|
1245
|
+
// Axios
|
1246
|
+
config: this.config,
|
1247
|
+
code: this.code
|
1248
|
+
};
|
1249
|
+
};
|
937
1250
|
return error;
|
938
1251
|
};
|
939
1252
|
|
940
1253
|
|
941
1254
|
/***/ }),
|
942
|
-
/*
|
943
|
-
/***/ (function(module, exports, __webpack_require__) {
|
944
|
-
|
945
|
-
'use strict';
|
946
|
-
|
947
|
-
var utils = __webpack_require__(2);
|
948
|
-
|
949
|
-
function encode(val) {
|
950
|
-
return encodeURIComponent(val).
|
951
|
-
replace(/%40/gi, '@').
|
952
|
-
replace(/%3A/gi, ':').
|
953
|
-
replace(/%24/g, '$').
|
954
|
-
replace(/%2C/gi, ',').
|
955
|
-
replace(/%20/g, '+').
|
956
|
-
replace(/%5B/gi, '[').
|
957
|
-
replace(/%5D/gi, ']');
|
958
|
-
}
|
959
|
-
|
960
|
-
/**
|
961
|
-
* Build a URL by appending params to the end
|
962
|
-
*
|
963
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
964
|
-
* @param {object} [params] The params to be appended
|
965
|
-
* @returns {string} The formatted url
|
966
|
-
*/
|
967
|
-
module.exports = function buildURL(url, params, paramsSerializer) {
|
968
|
-
/*eslint no-param-reassign:0*/
|
969
|
-
if (!params) {
|
970
|
-
return url;
|
971
|
-
}
|
972
|
-
|
973
|
-
var serializedParams;
|
974
|
-
if (paramsSerializer) {
|
975
|
-
serializedParams = paramsSerializer(params);
|
976
|
-
} else if (utils.isURLSearchParams(params)) {
|
977
|
-
serializedParams = params.toString();
|
978
|
-
} else {
|
979
|
-
var parts = [];
|
980
|
-
|
981
|
-
utils.forEach(params, function serialize(val, key) {
|
982
|
-
if (val === null || typeof val === 'undefined') {
|
983
|
-
return;
|
984
|
-
}
|
985
|
-
|
986
|
-
if (utils.isArray(val)) {
|
987
|
-
key = key + '[]';
|
988
|
-
}
|
989
|
-
|
990
|
-
if (!utils.isArray(val)) {
|
991
|
-
val = [val];
|
992
|
-
}
|
993
|
-
|
994
|
-
utils.forEach(val, function parseValue(v) {
|
995
|
-
if (utils.isDate(v)) {
|
996
|
-
v = v.toISOString();
|
997
|
-
} else if (utils.isObject(v)) {
|
998
|
-
v = JSON.stringify(v);
|
999
|
-
}
|
1000
|
-
parts.push(encode(key) + '=' + encode(v));
|
1001
|
-
});
|
1002
|
-
});
|
1003
|
-
|
1004
|
-
serializedParams = parts.join('&');
|
1005
|
-
}
|
1006
|
-
|
1007
|
-
if (serializedParams) {
|
1008
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
1009
|
-
}
|
1010
|
-
|
1011
|
-
return url;
|
1012
|
-
};
|
1013
|
-
|
1014
|
-
|
1015
|
-
/***/ }),
|
1016
|
-
/* 13 */
|
1255
|
+
/* 17 */
|
1017
1256
|
/***/ (function(module, exports, __webpack_require__) {
|
1018
1257
|
|
1019
1258
|
'use strict';
|
@@ -1072,7 +1311,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1072
1311
|
|
1073
1312
|
|
1074
1313
|
/***/ }),
|
1075
|
-
/*
|
1314
|
+
/* 18 */
|
1076
1315
|
/***/ (function(module, exports, __webpack_require__) {
|
1077
1316
|
|
1078
1317
|
'use strict';
|
@@ -1084,111 +1323,69 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1084
1323
|
|
1085
1324
|
// Standard browser envs have full support of the APIs needed to test
|
1086
1325
|
// whether the request URL is of the same origin as current location.
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1326
|
+
(function standardBrowserEnv() {
|
1327
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
1328
|
+
var urlParsingNode = document.createElement('a');
|
1329
|
+
var originURL;
|
1091
1330
|
|
1092
|
-
|
1331
|
+
/**
|
1093
1332
|
* Parse a URL to discover it's components
|
1094
1333
|
*
|
1095
1334
|
* @param {String} url The URL to be parsed
|
1096
1335
|
* @returns {Object}
|
1097
1336
|
*/
|
1098
|
-
|
1099
|
-
|
1337
|
+
function resolveURL(url) {
|
1338
|
+
var href = url;
|
1100
1339
|
|
1101
|
-
|
1340
|
+
if (msie) {
|
1102
1341
|
// IE needs attribute set twice to normalize properties
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1342
|
+
urlParsingNode.setAttribute('href', href);
|
1343
|
+
href = urlParsingNode.href;
|
1344
|
+
}
|
1106
1345
|
|
1107
|
-
|
1346
|
+
urlParsingNode.setAttribute('href', href);
|
1108
1347
|
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1348
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
1349
|
+
return {
|
1350
|
+
href: urlParsingNode.href,
|
1351
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
1352
|
+
host: urlParsingNode.host,
|
1353
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
1354
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
1355
|
+
hostname: urlParsingNode.hostname,
|
1356
|
+
port: urlParsingNode.port,
|
1357
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
1358
|
+
urlParsingNode.pathname :
|
1359
|
+
'/' + urlParsingNode.pathname
|
1360
|
+
};
|
1361
|
+
}
|
1123
1362
|
|
1124
|
-
|
1363
|
+
originURL = resolveURL(window.location.href);
|
1125
1364
|
|
1126
|
-
|
1365
|
+
/**
|
1127
1366
|
* Determine if a URL shares the same origin as the current location
|
1128
1367
|
*
|
1129
1368
|
* @param {String} requestURL The URL to test
|
1130
1369
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
1131
1370
|
*/
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1371
|
+
return function isURLSameOrigin(requestURL) {
|
1372
|
+
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
1373
|
+
return (parsed.protocol === originURL.protocol &&
|
1135
1374
|
parsed.host === originURL.host);
|
1136
|
-
|
1137
|
-
|
1375
|
+
};
|
1376
|
+
})() :
|
1138
1377
|
|
1139
1378
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1379
|
+
(function nonStandardBrowserEnv() {
|
1380
|
+
return function isURLSameOrigin() {
|
1381
|
+
return true;
|
1382
|
+
};
|
1383
|
+
})()
|
1145
1384
|
);
|
1146
1385
|
|
1147
1386
|
|
1148
1387
|
/***/ }),
|
1149
|
-
/*
|
1150
|
-
/***/ (function(module, exports) {
|
1151
|
-
|
1152
|
-
'use strict';
|
1153
|
-
|
1154
|
-
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
1155
|
-
|
1156
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
1157
|
-
|
1158
|
-
function E() {
|
1159
|
-
this.message = 'String contains an invalid character';
|
1160
|
-
}
|
1161
|
-
E.prototype = new Error;
|
1162
|
-
E.prototype.code = 5;
|
1163
|
-
E.prototype.name = 'InvalidCharacterError';
|
1164
|
-
|
1165
|
-
function btoa(input) {
|
1166
|
-
var str = String(input);
|
1167
|
-
var output = '';
|
1168
|
-
for (
|
1169
|
-
// initialize result and counter
|
1170
|
-
var block, charCode, idx = 0, map = chars;
|
1171
|
-
// if the next str index does not exist:
|
1172
|
-
// change the mapping table to "="
|
1173
|
-
// check if d has no fractional digits
|
1174
|
-
str.charAt(idx | 0) || (map = '=', idx % 1);
|
1175
|
-
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
|
1176
|
-
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
1177
|
-
) {
|
1178
|
-
charCode = str.charCodeAt(idx += 3 / 4);
|
1179
|
-
if (charCode > 0xFF) {
|
1180
|
-
throw new E();
|
1181
|
-
}
|
1182
|
-
block = block << 8 | charCode;
|
1183
|
-
}
|
1184
|
-
return output;
|
1185
|
-
}
|
1186
|
-
|
1187
|
-
module.exports = btoa;
|
1188
|
-
|
1189
|
-
|
1190
|
-
/***/ }),
|
1191
|
-
/* 16 */
|
1388
|
+
/* 19 */
|
1192
1389
|
/***/ (function(module, exports, __webpack_require__) {
|
1193
1390
|
|
1194
1391
|
'use strict';
|
@@ -1199,246 +1396,59 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1199
1396
|
utils.isStandardBrowserEnv() ?
|
1200
1397
|
|
1201
1398
|
// Standard browser envs support document.cookie
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1399
|
+
(function standardBrowserEnv() {
|
1400
|
+
return {
|
1401
|
+
write: function write(name, value, expires, path, domain, secure) {
|
1402
|
+
var cookie = [];
|
1403
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
1207
1404
|
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1405
|
+
if (utils.isNumber(expires)) {
|
1406
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
1407
|
+
}
|
1211
1408
|
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1409
|
+
if (utils.isString(path)) {
|
1410
|
+
cookie.push('path=' + path);
|
1411
|
+
}
|
1215
1412
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1413
|
+
if (utils.isString(domain)) {
|
1414
|
+
cookie.push('domain=' + domain);
|
1415
|
+
}
|
1219
1416
|
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1417
|
+
if (secure === true) {
|
1418
|
+
cookie.push('secure');
|
1419
|
+
}
|
1223
1420
|
|
1224
|
-
|
1225
|
-
|
1421
|
+
document.cookie = cookie.join('; ');
|
1422
|
+
},
|
1226
1423
|
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1424
|
+
read: function read(name) {
|
1425
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
1426
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
1427
|
+
},
|
1231
1428
|
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1429
|
+
remove: function remove(name) {
|
1430
|
+
this.write(name, '', Date.now() - 86400000);
|
1431
|
+
}
|
1432
|
+
};
|
1433
|
+
})() :
|
1237
1434
|
|
1238
1435
|
// Non standard browser env (web workers, react-native) lack needed support.
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1436
|
+
(function nonStandardBrowserEnv() {
|
1437
|
+
return {
|
1438
|
+
write: function write() {},
|
1439
|
+
read: function read() { return null; },
|
1440
|
+
remove: function remove() {}
|
1441
|
+
};
|
1442
|
+
})()
|
1246
1443
|
);
|
1247
1444
|
|
1248
1445
|
|
1249
|
-
/***/ }),
|
1250
|
-
/* 17 */
|
1251
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1252
|
-
|
1253
|
-
'use strict';
|
1254
|
-
|
1255
|
-
var utils = __webpack_require__(2);
|
1256
|
-
|
1257
|
-
function InterceptorManager() {
|
1258
|
-
this.handlers = [];
|
1259
|
-
}
|
1260
|
-
|
1261
|
-
/**
|
1262
|
-
* Add a new interceptor to the stack
|
1263
|
-
*
|
1264
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
1265
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
1266
|
-
*
|
1267
|
-
* @return {Number} An ID used to remove interceptor later
|
1268
|
-
*/
|
1269
|
-
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
1270
|
-
this.handlers.push({
|
1271
|
-
fulfilled: fulfilled,
|
1272
|
-
rejected: rejected
|
1273
|
-
});
|
1274
|
-
return this.handlers.length - 1;
|
1275
|
-
};
|
1276
|
-
|
1277
|
-
/**
|
1278
|
-
* Remove an interceptor from the stack
|
1279
|
-
*
|
1280
|
-
* @param {Number} id The ID that was returned by `use`
|
1281
|
-
*/
|
1282
|
-
InterceptorManager.prototype.eject = function eject(id) {
|
1283
|
-
if (this.handlers[id]) {
|
1284
|
-
this.handlers[id] = null;
|
1285
|
-
}
|
1286
|
-
};
|
1287
|
-
|
1288
|
-
/**
|
1289
|
-
* Iterate over all the registered interceptors
|
1290
|
-
*
|
1291
|
-
* This method is particularly useful for skipping over any
|
1292
|
-
* interceptors that may have become `null` calling `eject`.
|
1293
|
-
*
|
1294
|
-
* @param {Function} fn The function to call for each interceptor
|
1295
|
-
*/
|
1296
|
-
InterceptorManager.prototype.forEach = function forEach(fn) {
|
1297
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
1298
|
-
if (h !== null) {
|
1299
|
-
fn(h);
|
1300
|
-
}
|
1301
|
-
});
|
1302
|
-
};
|
1303
|
-
|
1304
|
-
module.exports = InterceptorManager;
|
1305
|
-
|
1306
|
-
|
1307
|
-
/***/ }),
|
1308
|
-
/* 18 */
|
1309
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1310
|
-
|
1311
|
-
'use strict';
|
1312
|
-
|
1313
|
-
var utils = __webpack_require__(2);
|
1314
|
-
var transformData = __webpack_require__(19);
|
1315
|
-
var isCancel = __webpack_require__(20);
|
1316
|
-
var defaults = __webpack_require__(6);
|
1317
|
-
var isAbsoluteURL = __webpack_require__(21);
|
1318
|
-
var combineURLs = __webpack_require__(22);
|
1319
|
-
|
1320
|
-
/**
|
1321
|
-
* Throws a `Cancel` if cancellation has been requested.
|
1322
|
-
*/
|
1323
|
-
function throwIfCancellationRequested(config) {
|
1324
|
-
if (config.cancelToken) {
|
1325
|
-
config.cancelToken.throwIfRequested();
|
1326
|
-
}
|
1327
|
-
}
|
1328
|
-
|
1329
|
-
/**
|
1330
|
-
* Dispatch a request to the server using the configured adapter.
|
1331
|
-
*
|
1332
|
-
* @param {object} config The config that is to be used for the request
|
1333
|
-
* @returns {Promise} The Promise to be fulfilled
|
1334
|
-
*/
|
1335
|
-
module.exports = function dispatchRequest(config) {
|
1336
|
-
throwIfCancellationRequested(config);
|
1337
|
-
|
1338
|
-
// Support baseURL config
|
1339
|
-
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
1340
|
-
config.url = combineURLs(config.baseURL, config.url);
|
1341
|
-
}
|
1342
|
-
|
1343
|
-
// Ensure headers exist
|
1344
|
-
config.headers = config.headers || {};
|
1345
|
-
|
1346
|
-
// Transform request data
|
1347
|
-
config.data = transformData(
|
1348
|
-
config.data,
|
1349
|
-
config.headers,
|
1350
|
-
config.transformRequest
|
1351
|
-
);
|
1352
|
-
|
1353
|
-
// Flatten headers
|
1354
|
-
config.headers = utils.merge(
|
1355
|
-
config.headers.common || {},
|
1356
|
-
config.headers[config.method] || {},
|
1357
|
-
config.headers || {}
|
1358
|
-
);
|
1359
|
-
|
1360
|
-
utils.forEach(
|
1361
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
1362
|
-
function cleanHeaderConfig(method) {
|
1363
|
-
delete config.headers[method];
|
1364
|
-
}
|
1365
|
-
);
|
1366
|
-
|
1367
|
-
var adapter = config.adapter || defaults.adapter;
|
1368
|
-
|
1369
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
1370
|
-
throwIfCancellationRequested(config);
|
1371
|
-
|
1372
|
-
// Transform response data
|
1373
|
-
response.data = transformData(
|
1374
|
-
response.data,
|
1375
|
-
response.headers,
|
1376
|
-
config.transformResponse
|
1377
|
-
);
|
1378
|
-
|
1379
|
-
return response;
|
1380
|
-
}, function onAdapterRejection(reason) {
|
1381
|
-
if (!isCancel(reason)) {
|
1382
|
-
throwIfCancellationRequested(config);
|
1383
|
-
|
1384
|
-
// Transform response data
|
1385
|
-
if (reason && reason.response) {
|
1386
|
-
reason.response.data = transformData(
|
1387
|
-
reason.response.data,
|
1388
|
-
reason.response.headers,
|
1389
|
-
config.transformResponse
|
1390
|
-
);
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
return Promise.reject(reason);
|
1395
|
-
});
|
1396
|
-
};
|
1397
|
-
|
1398
|
-
|
1399
|
-
/***/ }),
|
1400
|
-
/* 19 */
|
1401
|
-
/***/ (function(module, exports, __webpack_require__) {
|
1402
|
-
|
1403
|
-
'use strict';
|
1404
|
-
|
1405
|
-
var utils = __webpack_require__(2);
|
1406
|
-
|
1407
|
-
/**
|
1408
|
-
* Transform the data for a request or a response
|
1409
|
-
*
|
1410
|
-
* @param {Object|String} data The data to be transformed
|
1411
|
-
* @param {Array} headers The headers for the request or response
|
1412
|
-
* @param {Array|Function} fns A single function or Array of functions
|
1413
|
-
* @returns {*} The resulting transformed data
|
1414
|
-
*/
|
1415
|
-
module.exports = function transformData(data, headers, fns) {
|
1416
|
-
/*eslint no-param-reassign:0*/
|
1417
|
-
utils.forEach(fns, function transform(fn) {
|
1418
|
-
data = fn(data, headers);
|
1419
|
-
});
|
1420
|
-
|
1421
|
-
return data;
|
1422
|
-
};
|
1423
|
-
|
1424
|
-
|
1425
1446
|
/***/ }),
|
1426
1447
|
/* 20 */
|
1427
1448
|
/***/ (function(module, exports) {
|
1428
1449
|
|
1429
1450
|
'use strict';
|
1430
1451
|
|
1431
|
-
module.exports = function isCancel(value) {
|
1432
|
-
return !!(value && value.__CANCEL__);
|
1433
|
-
};
|
1434
|
-
|
1435
|
-
|
1436
|
-
/***/ }),
|
1437
|
-
/* 21 */
|
1438
|
-
/***/ (function(module, exports) {
|
1439
|
-
|
1440
|
-
'use strict';
|
1441
|
-
|
1442
1452
|
/**
|
1443
1453
|
* Determines whether the specified URL is absolute
|
1444
1454
|
*
|
@@ -1454,7 +1464,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1454
1464
|
|
1455
1465
|
|
1456
1466
|
/***/ }),
|
1457
|
-
/*
|
1467
|
+
/* 21 */
|
1458
1468
|
/***/ (function(module, exports) {
|
1459
1469
|
|
1460
1470
|
'use strict';
|
@@ -1473,6 +1483,63 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
1473
1483
|
};
|
1474
1484
|
|
1475
1485
|
|
1486
|
+
/***/ }),
|
1487
|
+
/* 22 */
|
1488
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1489
|
+
|
1490
|
+
'use strict';
|
1491
|
+
|
1492
|
+
var utils = __webpack_require__(2);
|
1493
|
+
|
1494
|
+
/**
|
1495
|
+
* Config-specific merge-function which creates a new config-object
|
1496
|
+
* by merging two configuration objects together.
|
1497
|
+
*
|
1498
|
+
* @param {Object} config1
|
1499
|
+
* @param {Object} config2
|
1500
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
1501
|
+
*/
|
1502
|
+
module.exports = function mergeConfig(config1, config2) {
|
1503
|
+
// eslint-disable-next-line no-param-reassign
|
1504
|
+
config2 = config2 || {};
|
1505
|
+
var config = {};
|
1506
|
+
|
1507
|
+
utils.forEach(['url', 'method', 'params', 'data'], function valueFromConfig2(prop) {
|
1508
|
+
if (typeof config2[prop] !== 'undefined') {
|
1509
|
+
config[prop] = config2[prop];
|
1510
|
+
}
|
1511
|
+
});
|
1512
|
+
|
1513
|
+
utils.forEach(['headers', 'auth', 'proxy'], function mergeDeepProperties(prop) {
|
1514
|
+
if (utils.isObject(config2[prop])) {
|
1515
|
+
config[prop] = utils.deepMerge(config1[prop], config2[prop]);
|
1516
|
+
} else if (typeof config2[prop] !== 'undefined') {
|
1517
|
+
config[prop] = config2[prop];
|
1518
|
+
} else if (utils.isObject(config1[prop])) {
|
1519
|
+
config[prop] = utils.deepMerge(config1[prop]);
|
1520
|
+
} else if (typeof config1[prop] !== 'undefined') {
|
1521
|
+
config[prop] = config1[prop];
|
1522
|
+
}
|
1523
|
+
});
|
1524
|
+
|
1525
|
+
utils.forEach([
|
1526
|
+
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
1527
|
+
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
1528
|
+
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength',
|
1529
|
+
'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken',
|
1530
|
+
'socketPath'
|
1531
|
+
], function defaultToConfig2(prop) {
|
1532
|
+
if (typeof config2[prop] !== 'undefined') {
|
1533
|
+
config[prop] = config2[prop];
|
1534
|
+
} else if (typeof config1[prop] !== 'undefined') {
|
1535
|
+
config[prop] = config1[prop];
|
1536
|
+
}
|
1537
|
+
});
|
1538
|
+
|
1539
|
+
return config;
|
1540
|
+
};
|
1541
|
+
|
1542
|
+
|
1476
1543
|
/***/ }),
|
1477
1544
|
/* 23 */
|
1478
1545
|
/***/ (function(module, exports) {
|