@faasjs/react 0.0.2-beta.275 → 0.0.2-beta.280
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/lib/browser/src/index.d.ts +1 -1
- package/lib/index.js +10 -10
- package/package.json +3 -2
package/lib/index.js
CHANGED
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
async action(action, params, options = {}) {
|
|
44
44
|
const url = this.host + action.toLowerCase() + '?_=' + new Date().getTime().toString();
|
|
45
45
|
options = Object.assign(Object.assign({}, this.defaultOptions), options);
|
|
46
|
+
const xhr = new XMLHttpRequest();
|
|
47
|
+
xhr.open('POST', url);
|
|
48
|
+
xhr.withCredentials = true;
|
|
49
|
+
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
50
|
+
if (options.beforeRequest)
|
|
51
|
+
await options.beforeRequest({
|
|
52
|
+
action,
|
|
53
|
+
params,
|
|
54
|
+
xhr
|
|
55
|
+
});
|
|
46
56
|
return new Promise(function (resolve, reject) {
|
|
47
|
-
const xhr = new XMLHttpRequest();
|
|
48
|
-
xhr.open('POST', url);
|
|
49
|
-
xhr.withCredentials = true;
|
|
50
|
-
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
|
|
51
|
-
if (options.beforeRequest)
|
|
52
|
-
options.beforeRequest({
|
|
53
|
-
action,
|
|
54
|
-
params,
|
|
55
|
-
xhr
|
|
56
|
-
});
|
|
57
57
|
xhr.onload = function () {
|
|
58
58
|
var _a;
|
|
59
59
|
let res = xhr.response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/react",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.280",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/react/src/index.d.ts",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"lib"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
+
"@faasjs/browser": "*",
|
|
20
21
|
"react": "*"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
@@ -26,5 +27,5 @@
|
|
|
26
27
|
"rollup-plugin-typescript2": "*",
|
|
27
28
|
"typescript": "*"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "7f68b54ee55e1a325a1e9a422b81b8e088a74d63"
|
|
30
31
|
}
|