@hlw-uni/mp-vue 2.0.2 → 2.0.4
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/app.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/app.ts +2 -2
package/dist/app.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1846,7 +1846,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1846
|
const offError = http.onError((err) => {
|
|
1847
1847
|
var _a;
|
|
1848
1848
|
if (err.message.includes("401")) {
|
|
1849
|
-
(_a = opts.
|
|
1849
|
+
(_a = opts.onLogout) == null ? void 0 : _a.call(opts);
|
|
1850
1850
|
}
|
|
1851
1851
|
});
|
|
1852
1852
|
_interceptorCleanup = [offRequest, offResponse, offError];
|
package/dist/index.mjs
CHANGED
|
@@ -1845,7 +1845,7 @@ function setupInterceptors(options = {}) {
|
|
|
1845
1845
|
const offError = http.onError((err) => {
|
|
1846
1846
|
var _a;
|
|
1847
1847
|
if (err.message.includes("401")) {
|
|
1848
|
-
(_a = opts.
|
|
1848
|
+
(_a = opts.onLogout) == null ? void 0 : _a.call(opts);
|
|
1849
1849
|
}
|
|
1850
1850
|
});
|
|
1851
1851
|
_interceptorCleanup = [offRequest, offResponse, offError];
|
package/package.json
CHANGED
package/src/app.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface InterceptorOptions {
|
|
|
20
20
|
/** Token 来源函数 */
|
|
21
21
|
getToken?: () => string;
|
|
22
22
|
/** 登录失效时的处理函数 */
|
|
23
|
-
|
|
23
|
+
onLogout?: () => void;
|
|
24
24
|
/** 接口业务错误码是否自动 toast */
|
|
25
25
|
autoToastError?: boolean;
|
|
26
26
|
}
|
|
@@ -165,7 +165,7 @@ export function setupInterceptors(options: InterceptorOptions & { sigSecret?: st
|
|
|
165
165
|
*/
|
|
166
166
|
const offError = http.onError((err: Error) => {
|
|
167
167
|
if (err.message.includes('401')) {
|
|
168
|
-
opts.
|
|
168
|
+
opts.onLogout?.();
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
|