From c078080eaed3abeae7b5d70ec8944375568cdc91 Mon Sep 17 00:00:00 2001 From: xinquiry <100398322+xinquiry@users.noreply.github.com> Date: Wed, 21 Jan 2026 18:51:25 +0800 Subject: [PATCH] fix: correct redemption API path and wallet query key - Update redemptionService.ts to use /business/ instead of /redemption/ (backend mounts the router at /business prefix) - Fix query key mismatch in CheckInCalendar.tsx for wallet invalidation Co-Authored-By: Claude --- web/src/components/features/CheckInCalendar.tsx | 2 +- web/src/service/redemptionService.ts | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/src/components/features/CheckInCalendar.tsx b/web/src/components/features/CheckInCalendar.tsx index 7cd0b104..ee8a5f04 100644 --- a/web/src/components/features/CheckInCalendar.tsx +++ b/web/src/components/features/CheckInCalendar.tsx @@ -195,7 +195,7 @@ export function CheckInCalendar({ onCheckInSuccess }: CheckInCalendarProps) { // Invalidate queries to refresh data await queryClient.invalidateQueries({ queryKey: ["check-in"] }); - await queryClient.invalidateQueries({ queryKey: ["wallet"] }); + await queryClient.invalidateQueries({ queryKey: ["userWallet"] }); onCheckInSuccess?.(response); } catch (error) { diff --git a/web/src/service/redemptionService.ts b/web/src/service/redemptionService.ts index d2d2dff5..e52f8e34 100644 --- a/web/src/service/redemptionService.ts +++ b/web/src/service/redemptionService.ts @@ -95,7 +95,7 @@ class RedemptionService { */ async redeemCode(code: string): Promise { const response = await fetch( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/redeem`, + `${this.getBackendUrl()}/xyzen/api/v1/business/redeem`, { method: "POST", headers: this.createAuthHeaders(), @@ -118,7 +118,7 @@ class RedemptionService { */ async getUserWallet(): Promise { const response = await fetch( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/wallet`, + `${this.getBackendUrl()}/xyzen/api/v1/business/wallet`, { method: "GET", headers: this.createAuthHeaders(), @@ -143,7 +143,7 @@ class RedemptionService { offset = 0, ): Promise { const response = await fetch( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/history?limit=${limit}&offset=${offset}`, + `${this.getBackendUrl()}/xyzen/api/v1/business/history?limit=${limit}&offset=${offset}`, { method: "GET", headers: this.createAuthHeaders(), @@ -169,7 +169,7 @@ class RedemptionService { tz?: string, ): Promise { const url = new URL( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/admin/stats/daily-tokens`, + `${this.getBackendUrl()}/xyzen/api/v1/business/admin/stats/daily-tokens`, ); if (date) { url.searchParams.append("date", date); @@ -204,7 +204,7 @@ class RedemptionService { limit = 20, ): Promise { const response = await fetch( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/admin/stats/top-users?limit=${limit}`, + `${this.getBackendUrl()}/xyzen/api/v1/business/admin/stats/top-users?limit=${limit}`, { method: "GET", headers: { @@ -236,7 +236,7 @@ class RedemptionService { offset = 0, ): Promise { const url = new URL( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/admin/stats/consume-records`, + `${this.getBackendUrl()}/xyzen/api/v1/business/admin/stats/consume-records`, ); if (startDate) { url.searchParams.append("start_date", startDate); @@ -314,7 +314,7 @@ class RedemptionService { tz?: string, ): Promise { const url = new URL( - `${this.getBackendUrl()}/xyzen/api/v1/redemption/admin/stats/user-activity`, + `${this.getBackendUrl()}/xyzen/api/v1/business/admin/stats/user-activity`, ); if (startDate) { url.searchParams.append("start_date", startDate);