fix(checkout): fix conditional react hook calls in CheckoutPage

This commit is contained in:
parsa committed 2026-08-22 19:30:05 +03:30
1 parent c35cff5671
commit b13699f955
1 file changed
+3 -5
@@ -41,6 +41,9 @@ export default function CheckoutPage() {
const [showTopUpModal, setShowTopUpModal] = useState(false);
const [showAddressModal, setShowAddressModal] = useState(false);
const isRefillEnabled = useSettingsStore((state) => state.getText('REFILL_SUBSCRIPTION_ENABLED', 'false') === 'true');
const refillPercent = Number(useSettingsStore((state) => state.getText('REFILL_REWARD_PERCENT', '5'))) || 5;
const [selectedPetId, setSelectedPetId] = useState<string | null>(activePetId || (pets[0]?.id ?? null));
const [selectedAddressId, setSelectedAddressId] = useState<string>('');
@@ -255,11 +258,6 @@ export default function CheckoutPage() {
</div>
</div>
);
}
const isRefillEnabled = useSettingsStore((state) => state.getText('REFILL_SUBSCRIPTION_ENABLED', 'false') === 'true');
const refillPercent = Number(useSettingsStore((state) => state.getText('REFILL_REWARD_PERCENT', '5'))) || 5;
return (
<div className="min-h-screen bg-medical-gray-50/60 py-4 sm:py-8 px-3 sm:px-6 font-vazir w-full max-w-full overflow-x-hidden text-right" dir="rtl">
<div className="max-w-7xl mx-auto w-full">