From 3714621173c606c4c58439ed8941100ce9ddea14 Mon Sep 17 00:00:00 2001
From: Codex Assistant <codex@example.com>
Date: 星期三, 05 十一月 2025 15:10:49 +0800
Subject: [PATCH] bug
---
web/src/api/promotion.js | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/web/src/api/promotion.js b/web/src/api/promotion.js
index 87b678c..ff02737 100644
--- a/web/src/api/promotion.js
+++ b/web/src/api/promotion.js
@@ -4,16 +4,23 @@
const GET_PROMOTION_COMPETITIONS = `
query GetPromotionCompetitions($name: String, $page: Int, $size: Int) {
promotionCompetitions(name: $name, page: $page, size: $size) {
- id
- competitionName
- stageName
- maxParticipants
- currentCount
- status
- startTime
- endTime
- sortOrder
- state
+ content {
+ id
+ competitionId
+ competitionName
+ stageName
+ maxParticipants
+ currentCount
+ status
+ startTime
+ endTime
+ sortOrder
+ state
+ }
+ totalElements
+ page
+ size
+ totalPages
}
}
`
@@ -79,7 +86,7 @@
size: params.size || 10
}
const result = await graphqlRequest(GET_PROMOTION_COMPETITIONS, variables)
- return result.data.promotionCompetitions || []
+ return result?.data?.promotionCompetitions || []
} catch (error) {
console.error('鑾峰彇姣旇禌鏅嬬骇鍒楄〃澶辫触:', error)
throw error
@@ -95,7 +102,7 @@
size: params.size || 10
}
const result = await graphqlRequest(GET_COMPETITION_PARTICIPANTS, variables)
- return result.data.competitionParticipants || []
+ return result?.data?.competitionParticipants || []
} catch (error) {
console.error('鑾峰彇姣旇禌鍙傝禌浜哄憳澶辫触:', error)
throw error
@@ -106,8 +113,8 @@
async getPromotableParticipants(currentStageId) {
try {
const variables = { currentStageId }
- const data = await graphqlRequest(GET_PROMOTABLE_PARTICIPANTS, variables)
- return data.promotableParticipants
+ const result = await graphqlRequest(GET_PROMOTABLE_PARTICIPANTS, variables)
+ return result?.data?.promotableParticipants
} catch (error) {
console.error('鑾峰彇鍙檵绾у弬璧涜�呭垪琛ㄥけ璐�:', error)
throw error
@@ -124,8 +131,8 @@
targetStageId
}
}
- const data = await graphqlRequest(PROMOTE_PARTICIPANTS, variables)
- return data.promoteParticipants
+ const result = await graphqlRequest(PROMOTE_PARTICIPANTS, variables)
+ return result?.data?.promoteParticipants
} catch (error) {
console.error('鎵ц鏅嬬骇鎿嶄綔澶辫触:', error)
throw error
--
Gitblit v1.8.0