mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 23:29:08 +03:00
26 lines
622 B
TypeScript
26 lines
622 B
TypeScript
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
|
|
import { useSelectedOrganization } from './useSelectedOrganization'
|
|
|
|
export function useCurrentOrgPlan() {
|
|
const currentOrg = useSelectedOrganization()
|
|
const { data, isLoading, isSuccess } = useOrgSubscriptionQuery({
|
|
orgSlug: currentOrg?.slug,
|
|
})
|
|
|
|
if (isLoading) {
|
|
return {
|
|
plan: null,
|
|
usageBillingEnabled: null,
|
|
isLoading,
|
|
isSuccess: false,
|
|
}
|
|
} else {
|
|
return {
|
|
plan: data?.plan,
|
|
usageBillingEnabled: data?.usage_billing_enabled,
|
|
isLoading,
|
|
isSuccess,
|
|
}
|
|
}
|
|
}
|