1
0

fix(web): 修复看不懂的前端错误展示

This commit is contained in:
2024-11-21 19:18:34 +08:00
parent aeb89e2367
commit d354cb9733

View File

@@ -1,14 +1,10 @@
package com.eshore.gringotts.web.configuration;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.filter.SaServletFilter;
import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.router.SaHttpMethod;
import cn.dev33.satoken.router.SaRouter;
import cn.dev33.satoken.stp.StpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -35,7 +31,13 @@ public class SaTokenConfiguration implements WebMvcConfigurer {
.notMatch("/assets/**")
.notMatch("/pages/**")
.notMatch("/user/**")
.check(r -> StpUtil.checkLogin());
.check(r -> {
try {
StpUtil.checkLogin();
} catch (Exception e) {
throw new RuntimeException("账号未登陆", e);
}
});
})
)
.addPathPatterns("/**");