请求微信接口 报40001 token过过期 重新刷新token
This commit is contained in:
parent
7e6c42cee8
commit
0bfac346bc
|
|
@ -47,6 +47,9 @@ var WechatMpInstance = /** @class */ (function () {
|
|||
case 2:
|
||||
json = _a.sent();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error("\u8C03\u7528\u5FAE\u4FE1\u63A5\u53E3\u8FD4\u56DE\u51FA\u9519\uFF0Ccode\u662F".concat(json.errcode, "\uFF0C\u4FE1\u606F\u662F").concat(json.errmsg));
|
||||
}
|
||||
return [2 /*return*/, json];
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ var WechatPublicInstance = /** @class */ (function () {
|
|||
case 2:
|
||||
json = _a.sent();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error("\u8C03\u7528\u5FAE\u4FE1\u63A5\u53E3\u8FD4\u56DE\u51FA\u9519\uFF0Ccode\u662F".concat(json.errcode, "\uFF0C\u4FE1\u606F\u662F").concat(json.errmsg));
|
||||
}
|
||||
return [2 /*return*/, json];
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ var WechatWebInstance = /** @class */ (function () {
|
|||
case 2:
|
||||
json = _a.sent();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error("\u8C03\u7528\u5FAE\u4FE1\u63A5\u53E3\u8FD4\u56DE\u51FA\u9519\uFF0Ccode\u662F".concat(json.errcode, "\uFF0C\u4FE1\u606F\u662F").concat(json.errmsg));
|
||||
}
|
||||
return [2 /*return*/, json];
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ export class WechatMpInstance {
|
|||
if (contentType.includes('application/json')) {
|
||||
const json = await response.json();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error(
|
||||
`调用微信接口返回出错,code是${json.errcode},信息是${json.errmsg}`
|
||||
);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ export class WechatPublicInstance {
|
|||
if (contentType.includes('application/json')) {
|
||||
const json = await response.json();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error(
|
||||
`调用微信接口返回出错,code是${json.errcode},信息是${json.errmsg}`
|
||||
);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ export class WechatWebInstance {
|
|||
if (contentType.includes('application/json')) {
|
||||
const json = await response.json();
|
||||
if (typeof json.errcode === 'number' && json.errcode !== 0) {
|
||||
if (json.errcode === 40001) {
|
||||
this.refreshAccessToken();
|
||||
}
|
||||
throw new Error(
|
||||
`调用微信接口返回出错,code是${json.errcode},信息是${json.errmsg}`
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue