@ichaingo/request 1.4.61 → 1.4.63
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/index.js
CHANGED
|
@@ -176,10 +176,9 @@ async function refreshToken(config) {
|
|
|
176
176
|
await refreshPromise;
|
|
177
177
|
return config;
|
|
178
178
|
}
|
|
179
|
-
if (isTokenExpired()) {
|
|
179
|
+
if (await isTokenExpired()) {
|
|
180
180
|
refreshPromise = (async () => {
|
|
181
|
-
|
|
182
|
-
const res = await axiosInstance$1.get(`/api/refresh/token`, {
|
|
181
|
+
axiosInstance$1.get(`/api/refresh/token`, {
|
|
183
182
|
params: {
|
|
184
183
|
grant_type: "refresh_token",
|
|
185
184
|
refresh_token: getToken("refresh_token")
|
|
@@ -187,11 +186,18 @@ async function refreshToken(config) {
|
|
|
187
186
|
headers: {
|
|
188
187
|
...headers
|
|
189
188
|
}
|
|
190
|
-
})
|
|
191
|
-
|
|
189
|
+
}).then((res) => {
|
|
190
|
+
var _a;
|
|
191
|
+
if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) {
|
|
192
|
+
return res.data.data;
|
|
193
|
+
} else {
|
|
194
|
+
removeAllToken();
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
}).catch(() => {
|
|
192
198
|
removeAllToken();
|
|
193
|
-
|
|
194
|
-
|
|
199
|
+
return null;
|
|
200
|
+
});
|
|
195
201
|
})().finally(() => {
|
|
196
202
|
refreshPromise = null;
|
|
197
203
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../src/interceptors/refreshToken.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAY1D,wBAA8B,YAAY,CACxC,MAAM,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"refreshToken.d.ts","sourceRoot":"","sources":["../../src/interceptors/refreshToken.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AAY1D,wBAA8B,YAAY,CACxC,MAAM,EAAE,0BAA0B,4CAoCnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/request",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.63",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"js-cookie": "3.0.5",
|
|
23
23
|
"next": "^15.4.5",
|
|
24
24
|
"qs": "6.14.0",
|
|
25
|
-
"@ichaingo/logger": "1.4.
|
|
26
|
-
"@ichaingo/token": "1.4.
|
|
25
|
+
"@ichaingo/logger": "1.4.63",
|
|
26
|
+
"@ichaingo/token": "1.4.63"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/js-cookie": "^3.0.6",
|