mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
Update Subscription.tsx
This commit is contained in:
1 parent
e3ee24a937
commit
dcddadb0bf
1 file changed
+9
-6
@@ -5,10 +5,11 @@ import CostControl from './CostControl/CostControl'
|
||||
import SubscriptionTier from './Tier/SubscriptionTier'
|
||||
import { SUBSCRIPTION_PANEL_KEYS, useSubscriptionPageStateSnapshot } from 'state/subscription-page'
|
||||
import { useSelectedOrganization } from 'hooks'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export interface SubscriptionProps {}
|
||||
export interface SubscriptionProps { }
|
||||
|
||||
const Subscription = ({}: SubscriptionProps) => {
|
||||
const Subscription = ({ }: SubscriptionProps) => {
|
||||
const router = useRouter()
|
||||
const organization = useSelectedOrganization()
|
||||
const snap = useSubscriptionPageStateSnapshot()
|
||||
@@ -23,13 +24,15 @@ const Subscription = ({}: SubscriptionProps) => {
|
||||
const panel = router.query.panel
|
||||
const isOrgBilling = !!organization?.subscription_id
|
||||
|
||||
useEffect(() => {
|
||||
if (panel && typeof panel === 'string' && allowedValues.includes(panel)) {
|
||||
snap.setPanelKey(panel as SUBSCRIPTION_PANEL_KEYS)
|
||||
}
|
||||
}, [panel])
|
||||
|
||||
// No need to bother rendering, we'll redirect anyway
|
||||
if (isOrgBilling) return null
|
||||
|
||||
if (panel && typeof panel === 'string' && allowedValues.includes(panel)) {
|
||||
snap.setPanelKey(panel as SUBSCRIPTION_PANEL_KEYS)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="border-b">
|
||||
|
||||
Reference in new issue
Block a user