@ichaingo/request 1.4.68 → 1.4.72
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 +22 -20
- package/dist/interceptors/refreshToken.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -177,28 +177,30 @@ async function refreshToken(config) {
|
|
|
177
177
|
return config;
|
|
178
178
|
}
|
|
179
179
|
if (await isTokenExpired()) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}).catch(() => {
|
|
180
|
+
if (refreshPromise) {
|
|
181
|
+
await refreshPromise;
|
|
182
|
+
return config;
|
|
183
|
+
}
|
|
184
|
+
refreshPromise = axiosInstance$1.get(`/api/refresh/token`, {
|
|
185
|
+
params: {
|
|
186
|
+
grant_type: "refresh_token",
|
|
187
|
+
refresh_token: getToken("refresh_token")
|
|
188
|
+
},
|
|
189
|
+
headers: {
|
|
190
|
+
...headers
|
|
191
|
+
}
|
|
192
|
+
}).then((res) => {
|
|
193
|
+
var _a;
|
|
194
|
+
if ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) {
|
|
195
|
+
return res.data.data;
|
|
196
|
+
} else {
|
|
198
197
|
removeAllToken();
|
|
199
198
|
return null;
|
|
200
|
-
}
|
|
201
|
-
})
|
|
199
|
+
}
|
|
200
|
+
}).catch(() => {
|
|
201
|
+
removeAllToken();
|
|
202
|
+
return null;
|
|
203
|
+
}).finally(() => {
|
|
202
204
|
refreshPromise = null;
|
|
203
205
|
});
|
|
204
206
|
await refreshPromise;
|
|
@@ -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,4CAyCnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/request",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.72",
|
|
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.72",
|
|
26
|
+
"@ichaingo/token": "1.4.72"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/js-cookie": "^3.0.6",
|