fix(LOY-119): hiding redeemed rewards
some smaller cleanup on coupon property to avoid optional checks
This commit is contained in:
@@ -146,7 +146,7 @@ export const validateCmsRewardsWithRedeemSchema = z
|
||||
})
|
||||
.transform((data) => data.data.all_reward.items)
|
||||
|
||||
export type ApiReward = z.output<typeof validateApiRewardSchema>[0]
|
||||
export type ApiReward = z.output<typeof validateApiRewardSchema>[number]
|
||||
|
||||
export type SurpriseReward = z.output<typeof SurpriseReward>
|
||||
|
||||
@@ -207,7 +207,10 @@ const CouponReward = z.object({
|
||||
redeemLocation: z.string().optional(),
|
||||
operaRewardId: z.string().default(""),
|
||||
status: z.string().optional(),
|
||||
coupon: z.array(CouponData).optional(),
|
||||
coupon: z
|
||||
.array(CouponData)
|
||||
.optional()
|
||||
.transform((val) => val || []),
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -233,6 +236,10 @@ export const validateCategorizedRewardsSchema = z
|
||||
})),
|
||||
])
|
||||
|
||||
export type CategorizedApiReward = z.output<
|
||||
typeof validateCategorizedRewardsSchema
|
||||
>[number]
|
||||
|
||||
export const validateApiAllTiersSchema = z.record(
|
||||
z.nativeEnum(TierKey).transform((data) => {
|
||||
return TierKey[data as unknown as Key]
|
||||
|
||||
Reference in New Issue
Block a user