From cacf02681bfdda7926379d37d58ad1a21e398e1a Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期六, 04 十月 2025 19:08:12 +0800
Subject: [PATCH] fix(auth): 对无 Authorization 的 GraphQL 请求默认匿名放行到解析层,避免 400/403;公开查询仍优先识别后放行
---
web/src/api/region.js | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/web/src/api/region.js b/web/src/api/region.js
index 87cbcdf..d78274b 100644
--- a/web/src/api/region.js
+++ b/web/src/api/region.js
@@ -17,8 +17,8 @@
`
try {
- const data = await graphqlRequest(query)
- return data.regions || []
+ const result = await graphqlRequest(query)
+ return result.data.regions || []
} catch (error) {
throw new Error(error.message || '鑾峰彇鍦板尯鍒楄〃澶辫触')
}
@@ -39,8 +39,8 @@
`
try {
- const data = await graphqlRequest(query, { id })
- return data.region
+ const result = await graphqlRequest(query, { id })
+ return result.data.region
} catch (error) {
throw new Error(error.message || '鑾峰彇鍦板尯璇︽儏澶辫触')
}
@@ -98,8 +98,8 @@
`
try {
- const data = await graphqlRequest(query)
- return data.provinces || []
+ const result = await graphqlRequest(query)
+ return result.data.provinces || []
} catch (error) {
throw new Error(error.message || '鑾峰彇鐪佷唤鍒楄〃澶辫触')
}
@@ -119,8 +119,8 @@
`
try {
- const data = await graphqlRequest(query, { provinceId })
- return data.cities || []
+ const result = await graphqlRequest(query, { provinceId })
+ return result.data.cities || []
} catch (error) {
throw new Error(error.message || '鑾峰彇鍩庡競鍒楄〃澶辫触')
}
@@ -140,8 +140,8 @@
`
try {
- const data = await graphqlRequest(query, { cityId })
- return data.districts || []
+ const result = await graphqlRequest(query, { cityId })
+ return result.data.districts || []
} catch (error) {
throw new Error(error.message || '鑾峰彇鍖哄幙鍒楄〃澶辫触')
}
--
Gitblit v1.8.0