refactor(LOY-62): revert to switch case for ScriptedRewardText label text

This commit is contained in:
Chuma McPhoy
2025-01-13 16:38:56 +01:00
parent da31539610
commit 655103a0b5
4 changed files with 27 additions and 20 deletions

View File

@@ -1,13 +1,13 @@
import {
COUPON_REWARD_TYPES,
RESTAURANT_REWARD_IDS,
REWARD_IDS,
REWARD_TYPES,
} from "@/constants/rewards"
import type {
CouponRewardType,
RestaurantRewardId,
RewardId,
RewardType,
} from "@/types/components/myPages/rewards"
import type { RewardWithRedeem } from "@/server/routers/contentstack/reward/output"
@@ -46,8 +46,6 @@ export function isRestaurantOnSiteTierReward(
return isOnSiteTierReward(reward) && isRestaurantReward(reward.reward_id)
}
export function isCouponRewardType(
type: RewardWithRedeem["rewardType"]
): type is CouponRewardType {
return COUPON_REWARD_TYPES.some((t) => t === type)
export function getRewardType(type?: string): RewardType | null {
return REWARD_TYPES.find((t) => t === type) ?? null
}