注册页面店铺选择问题修复

This commit is contained in:
xiaowang
2026-02-24 11:17:15 +08:00
parent ab6684227b
commit 715209ede1
4 changed files with 20 additions and 11 deletions
+8 -1
View File
@@ -49,8 +49,15 @@ api.interceptors.response.use(
},
async (error: AxiosError) => {
const originalRequest = error.config as any
const isWhitelistedPath = (url: string) => {
return url?.includes('/user/login') ||
url?.includes('/user/register') ||
url?.includes('/user/refresh-token') ||
url?.includes('/shop/list/simple')
}
if (error.response?.status === 401 && !originalRequest._retry) {
if (error.response?.status === 401 && !originalRequest._retry && !isWhitelistedPath(originalRequest.url)) {
if (isRefreshing) {
return new Promise((resolve, reject) => {
failedQueue.push({ resolve, reject })
+1 -1
View File
@@ -206,7 +206,7 @@ const fetchShops = async () => {
loadingShops.value = true
try {
const response = await shopApi.getShopsSimple()
shops.value = response.data || []
shops.value = (response as unknown as any[]) || []
} catch (error) {
console.error('获取店铺列表失败:', error)
message.error('未登录,请先登录')
@@ -57,9 +57,10 @@ public class AuthInterceptor implements HandlerInterceptor {
}
private boolean isWhitelistedPath(String path) {
return path.contains("/user/login") ||
path.contains("/user/register") ||
path.contains("/user/refresh-token") ||
path.contains("/shop/list/simple");
return path.contains("/api/user/login") ||
path.contains("/api/user/register") ||
path.contains("/api/user/refresh-token") ||
path.contains("/api/shop/list/simple") ||
path.contains("/health");
}
}
@@ -16,11 +16,12 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addInterceptor(authInterceptor)
.addPathPatterns("/**")
.excludePathPatterns(
"/user/login",
"/user/register",
"/user/refresh-token",
"/shop/list/simple",
"/error"
"/api/user/login",
"/api/user/register",
"/api/user/refresh-token",
"/api/shop/list/simple",
"/error",
"/health/**"
);
}
}