let userInfo;
_before: async function () {
const clientInfo = this.getClientInfo();
const token = this.getUniIdToken();
this.uniID = uniID.createInstance({
clientInfo
});
userInfo = token ? await this.uniID.checkToken(token) : {};
throw new Error(
JSON.stringify({
errCode: userInfo.errCode,
errMsg: userInfo.errMsg
})
);
}
按照文档说明:checkToken接口可能返回uni-id-token-expired
、uni-id-check-token-failed
错误码,二者均会触发客户端跳转登陆页面。
如果在云对象内的方法return {errCode,errMsg}在客户端是可以触发登录页面的,但是在_before中throw会字符串原样输出,不会触发登录,请问怎么解决那?
1 个回复
DCloud_uniCloud_CRL
在_after中可以拦截error后再return