防止错误token导致的解析异常
This commit is contained in:
parent
6b5dd4d2be
commit
f6bc28000e
|
@ -59,6 +59,8 @@ public class TokenService
|
|||
// 获取请求携带的令牌
|
||||
String token = getToken(request);
|
||||
if (StringUtils.isNotEmpty(token))
|
||||
{
|
||||
try
|
||||
{
|
||||
Claims claims = parseToken(token);
|
||||
// 解析对应的权限以及用户信息
|
||||
|
@ -67,6 +69,10 @@ public class TokenService
|
|||
LoginUser user = redisCache.getCacheObject(userKey);
|
||||
return user;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ service.interceptors.response.use(res => {
|
|||
location.href = '/index';
|
||||
})
|
||||
}).catch(() => {});
|
||||
return Promise.reject('error')
|
||||
return Promise.reject()
|
||||
} else if (code === 500) {
|
||||
Message({
|
||||
message: msg,
|
||||
|
|
Loading…
Reference in New Issue