glitch-javascript-sdk 0.4.7 → 0.4.8
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/dist/cjs/index.js +1 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/util/Requests.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/util/Requests.ts +2 -11
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/util/Requests.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import axios, {
|
|
1
|
+
import axios, { AxiosPromise } from 'axios';
|
|
2
2
|
import Config from '../config/Config';
|
|
3
3
|
import HTTP_METHODS from '../constants/HttpMethods';
|
|
4
4
|
import Route from '../routes/interface';
|
|
5
5
|
import Response from './Response';
|
|
6
6
|
|
|
7
7
|
class Requests {
|
|
8
|
-
private static axiosInstance: AxiosInstance;
|
|
9
8
|
private static config: Config;
|
|
10
9
|
private static baseUrl = "";
|
|
11
10
|
private static authToken = "";
|
|
@@ -13,18 +12,10 @@ class Requests {
|
|
|
13
12
|
|
|
14
13
|
constructor(config: Config) {
|
|
15
14
|
Requests.config = config;
|
|
16
|
-
Requests.axiosInstance = axios.create({
|
|
17
|
-
baseURL: Requests.baseUrl,
|
|
18
|
-
headers: { 'Content-Type': 'application/json' },
|
|
19
|
-
});
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
public static setBaseUrl(url: string) {
|
|
23
18
|
Requests.baseUrl = url;
|
|
24
|
-
|
|
25
|
-
if(Requests.axiosInstance && Requests.axiosInstance.defaults) {
|
|
26
|
-
Requests.axiosInstance.defaults.baseURL = url;
|
|
27
|
-
}
|
|
28
19
|
}
|
|
29
20
|
|
|
30
21
|
public static setAuthToken(token: string) {
|
|
@@ -59,7 +50,7 @@ class Requests {
|
|
|
59
50
|
|
|
60
51
|
const validUri = uri.replace(/\/\//g, '/');
|
|
61
52
|
|
|
62
|
-
const axiosPromise =
|
|
53
|
+
const axiosPromise = axios({
|
|
63
54
|
method,
|
|
64
55
|
url: uri,
|
|
65
56
|
data: fileData || data,
|