Present use card option only if paid org subscription

This commit is contained in:
Joshen Lim committed 2023-07-04 18:09:40 +08:00
1 parent 97d90c3597
commit 1a57ebf15e
1 file changed
+12 -7
@@ -32,6 +32,7 @@ const PaymentMethods = () => {
const [showAddPaymentMethodModal, setShowAddPaymentMethodModal] = useState(false)
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })
console.log(subscription)
const {
data: paymentMethods,
error,
@@ -143,13 +144,17 @@ const PaymentMethods = () => {
size="tiny"
align="end"
overlay={[
<Dropdown.Item
key="make-default"
onClick={() => setSelectedMethodForUse(paymentMethod)}
>
Use this card
</Dropdown.Item>,
<Dropdown.Separator key="card-separator" />,
...(subscription?.plan.id !== 'free'
? [
<Dropdown.Item
key="make-default"
onClick={() => setSelectedMethodForUse(paymentMethod)}
>
Use this card
</Dropdown.Item>,
<Dropdown.Separator key="card-separator" />,
]
: []),
<Dropdown.Item
key="delete-method"
onClick={() => setSelectedMethodToDelete(paymentMethod)}