|
|
@@ -16,19 +16,9 @@ import type { InferResponseType } from 'hono/client'
|
|
|
type AdvertisementResponse = InferResponseType<typeof publicAdvertisementClient.$get, 200>
|
|
|
type Advertisement = AdvertisementResponse['data'][0]
|
|
|
|
|
|
-interface WechatCouponStock {
|
|
|
- id: number
|
|
|
- stockName: string
|
|
|
- stockDescription: string
|
|
|
- stockType: string
|
|
|
- couponAmount: number
|
|
|
- couponTotal: number
|
|
|
- couponRemaining: number
|
|
|
- beginTime: string
|
|
|
- endTime: string
|
|
|
- status: number
|
|
|
- coverImage: string
|
|
|
-}
|
|
|
+// 使用RPC类型安全提取代金券批次响应类型
|
|
|
+type WechatCouponStockResponse = InferResponseType<typeof wechatCouponStockClient.$get, 200>
|
|
|
+type WechatCouponStock = WechatCouponStockResponse['data'][0]
|
|
|
|
|
|
export default function IndexPage() {
|
|
|
const queryClient = useQueryClient()
|
|
|
@@ -64,7 +54,7 @@ export default function IndexPage() {
|
|
|
})
|
|
|
if (response.status !== 200) throw new Error('获取批次失败')
|
|
|
const result = await response.json()
|
|
|
- return result.data as WechatCouponStock[]
|
|
|
+ return result.data
|
|
|
},
|
|
|
})
|
|
|
|