mirror of
https://github.com/supabase/supabase.git
synced 2026-05-06 22:18:00 +08:00
review
This commit is contained in:
@@ -59,7 +59,7 @@ export const CreditCodeRedemption = ({
|
||||
const { data: org, isLoading: isOrgLoading } = useOrganizationQuery({ slug })
|
||||
const { data: orgBalance, isLoading: isOrgBalanceLoading } = useOrgBalanceQuery(
|
||||
{ orgSlug: slug },
|
||||
{ enabled: modalVisible }
|
||||
{ enabled: codeRedemptionModalVisible }
|
||||
)
|
||||
const combinedCreditBalanceCents = orgBalance?.total_balance_cents
|
||||
|
||||
|
||||
@@ -246,8 +246,10 @@ export const CreditTopUp = ({ slug }: { slug: string | undefined }) => {
|
||||
|
||||
const onSuccessfulPayment = async () => {
|
||||
onTopUpDialogVisibilityChange(false)
|
||||
await queryClient.invalidateQueries({ queryKey: subscriptionKeys.orgSubscription(slug) })
|
||||
await queryClient.invalidateQueries({ queryKey: subscriptionKeys.orgBalance(slug) })
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: subscriptionKeys.orgSubscription(slug) }),
|
||||
queryClient.invalidateQueries({ queryKey: subscriptionKeys.orgBalance(slug) }),
|
||||
])
|
||||
toast.success(
|
||||
'Successfully topped up balance. It may take a minute to reflect in your account.'
|
||||
)
|
||||
|
||||
@@ -94,13 +94,3 @@ export const generateUpgradeReasons = (originalPlan?: string, upgradedPlan?: str
|
||||
|
||||
return reasons
|
||||
}
|
||||
|
||||
// For `customerBalance`, negative sign means credit.
|
||||
// Negate it first so both sources contribute as positive credit amounts before combining.
|
||||
export const getTotalCreditBalanceCents = ({
|
||||
customerBalance = 0,
|
||||
prepaidCreditsBalance = 0,
|
||||
}: {
|
||||
customerBalance?: number
|
||||
prepaidCreditsBalance?: number
|
||||
}) => -customerBalance + prepaidCreditsBalance
|
||||
|
||||
Reference in New Issue
Block a user