@blocklet/discuss-kit 1.3.0 → 1.3.2
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/cjs/api.js +10 -0
- package/lib/es/api.js +10 -0
- package/package.json +4 -4
package/lib/cjs/api.js
CHANGED
|
@@ -10,6 +10,16 @@ request.interceptors.request.use(
|
|
|
10
10
|
},
|
|
11
11
|
(error) => Promise.reject(error)
|
|
12
12
|
);
|
|
13
|
+
request.interceptors.response.use(
|
|
14
|
+
(response) => {
|
|
15
|
+
const { responseType } = response.config;
|
|
16
|
+
if ((!responseType || responseType === "json") && response.headers["content-type"].indexOf("application/json") === -1) {
|
|
17
|
+
throw new Error("Invalid response");
|
|
18
|
+
}
|
|
19
|
+
return response;
|
|
20
|
+
},
|
|
21
|
+
(error) => Promise.reject(error)
|
|
22
|
+
);
|
|
13
23
|
const fetchRatingStats = async (id) => {
|
|
14
24
|
const { data } = await request.get(`/ratings/${id}/stats`);
|
|
15
25
|
return data;
|
package/lib/es/api.js
CHANGED
|
@@ -6,6 +6,16 @@ request.interceptors.request.use(
|
|
|
6
6
|
},
|
|
7
7
|
(error) => Promise.reject(error)
|
|
8
8
|
);
|
|
9
|
+
request.interceptors.response.use(
|
|
10
|
+
(response) => {
|
|
11
|
+
const { responseType } = response.config;
|
|
12
|
+
if ((!responseType || responseType === "json") && response.headers["content-type"].indexOf("application/json") === -1) {
|
|
13
|
+
throw new Error("Invalid response");
|
|
14
|
+
}
|
|
15
|
+
return response;
|
|
16
|
+
},
|
|
17
|
+
(error) => Promise.reject(error)
|
|
18
|
+
);
|
|
9
19
|
const fetchRatingStats = async (id) => {
|
|
10
20
|
const { data } = await request.get(`/ratings/${id}/stats`);
|
|
11
21
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "A react component for Discuss Kit blocklet.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/es/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@arcblock/did-connect": "^2.5.25",
|
|
38
38
|
"@arcblock/ux": "^2.5.25",
|
|
39
39
|
"@arcblock/ws": "^1.18.70",
|
|
40
|
-
"@blocklet/discuss-kit-ux": "1.3.
|
|
41
|
-
"@blocklet/editor": "1.3.
|
|
40
|
+
"@blocklet/discuss-kit-ux": "1.3.2",
|
|
41
|
+
"@blocklet/editor": "1.3.2",
|
|
42
42
|
"@emotion/react": "^11.10.5",
|
|
43
43
|
"@emotion/styled": "^11.10.5",
|
|
44
44
|
"@mui/icons-material": "^5.10.9",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"vite-plugin-build": "^0.7.1",
|
|
78
78
|
"vite-plugin-svgr": "^2.2.2"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "fea8199cf78b446619badf04ed3e7bf7ee2d0a52"
|
|
81
81
|
}
|