loyalty points
This commit is contained in:
@@ -74,7 +74,7 @@ function PaymentForm({ clientSecret, totalAmount, onSuccess, onCancel }) {
|
||||
}
|
||||
|
||||
export default function CartPage() {
|
||||
const { user, loading: authLoading } = useAuth();
|
||||
const { user, loading: authLoading, refreshUser } = useAuth();
|
||||
const {
|
||||
cart,
|
||||
cartLoading,
|
||||
@@ -373,6 +373,12 @@ export default function CartPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{user?.role === "CUSTOMER" && (
|
||||
<div className="cart-points-estimate">
|
||||
⭐ Earn <strong>{Math.floor(parseFloat(cart.totalAmount ?? 0))}</strong> loyalty point{Math.floor(parseFloat(cart.totalAmount ?? 0)) !== 1 ? "s" : ""} with this purchase
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="cart-coupon-section">
|
||||
{cart.couponCode && (
|
||||
<div className="cart-coupon-applied">
|
||||
@@ -444,6 +450,7 @@ export default function CartPage() {
|
||||
onSuccess={() => {
|
||||
setClientSecret(null);
|
||||
setConfirmed(true);
|
||||
refreshUser().catch(() => {});
|
||||
}}
|
||||
onCancel={async () => {
|
||||
await cancelCheckout().catch(() => {});
|
||||
|
||||
Reference in New Issue
Block a user