fix(1895): api/points/index.ts - fix TS errors (import types, hasEnoughPoints API, field names, DiscountKey)
This commit is contained in:
@@ -5,8 +5,10 @@
|
||||
import apiClient from "../client"
|
||||
import type {
|
||||
PointsBalance,
|
||||
PointsTransaction,
|
||||
PointsTransactionsParams,
|
||||
PointsTransactionsResponse,
|
||||
PointsPackage,
|
||||
PointsPackagesResponse,
|
||||
PointsRechargeRequest,
|
||||
PointsOrder,
|
||||
@@ -284,8 +286,13 @@ export async function createPointsOrder(req: PointsRechargeRequest): Promise<Poi
|
||||
if (POINTS_API_MOCK) {
|
||||
const pkg = MOCK_PACKAGES.packages.find((p) => p.id === req.package_id)
|
||||
const mt = MOCK_PACKAGES.user_member_type
|
||||
const discountKey = `discounted_price_for_${mt}` as keyof PointsPackage
|
||||
const price = (pkg?.[discountKey] as number | undefined) ?? pkg?.price ?? 0
|
||||
type DiscountKey =
|
||||
| "discounted_price_for_free"
|
||||
| "discounted_price_for_monthly"
|
||||
| "discounted_price_for_quarterly"
|
||||
| "discounted_price_for_yearly"
|
||||
const discountKey = `discounted_price_for_${mt}` as DiscountKey
|
||||
const price = pkg?.[discountKey] ?? pkg?.price ?? 0
|
||||
return new Promise((r) =>
|
||||
setTimeout(
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user