chore: fix recompense categorie
This commit is contained in:
@@ -2172,6 +2172,13 @@ export type RewardCategoryConfig = {
|
||||
amount: number;
|
||||
};
|
||||
|
||||
export type RewardItemConfig = {
|
||||
product_id: number;
|
||||
product_name: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
};
|
||||
|
||||
export type PointsPoolInfo = {
|
||||
key: string;
|
||||
name: string;
|
||||
@@ -2180,13 +2187,7 @@ export type PointsPoolInfo = {
|
||||
rewards_claimed: number;
|
||||
rewards_available: number;
|
||||
eligible_configs: RewardCategoryConfig[];
|
||||
};
|
||||
|
||||
export type RewardItemConfig = {
|
||||
product_id: number;
|
||||
product_name: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
eligible_reward_items: RewardItemConfig[];
|
||||
};
|
||||
|
||||
export type PointsRewardConfig = {
|
||||
|
||||
@@ -180,7 +180,7 @@ function ConsultationHistorique() {
|
||||
// Ouvre la modal de choix si plusieurs produits sont éligibles,
|
||||
// sinon réclame directement (1 seul produit configuré ou aucun item).
|
||||
const openRewardModal = (pool: PointsPoolInfo) => {
|
||||
const items = pointsRewards?.reward?.reward_items ?? [];
|
||||
const items = pool.eligible_reward_items ?? [];
|
||||
if (items.length > 1) {
|
||||
setSelectedProductId(items[0]?.product_id ?? null);
|
||||
setRewardModalPool(pool);
|
||||
@@ -716,7 +716,7 @@ function ConsultationHistorique() {
|
||||
</p>
|
||||
|
||||
<div className="reward-modal-products">
|
||||
{(pointsRewards.reward.reward_items ?? []).map(
|
||||
{(rewardModalPool.eligible_reward_items ?? []).map(
|
||||
(item) => {
|
||||
const isSelected =
|
||||
selectedProductId === item.product_id;
|
||||
|
||||
Reference in New Issue
Block a user