Files
supabase/apps/studio/hooks/misc/useCurrentOrgPlan.ts
Joshen Lim cab0585533 Fe 1799/consolidate to useselectedprojectquery and (#37684)
* Replace all usage of useProjectContext with useSelectedProjectQuery

* Replace all usage of useSelectedProject with useSelectedProjectQuery

* Replace all usage of useProjectByRef with useProjectByRefQuery

* Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery

* Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks

* Deprecate ProjecContext
2025-08-06 10:53:10 +07:00

22 lines
488 B
TypeScript

import { useSelectedOrganizationQuery } from './useSelectedOrganization'
export function useCurrentOrgPlan() {
const { data: currentOrg } = useSelectedOrganizationQuery()
if (!currentOrg) {
return {
plan: null,
usageBillingEnabled: null,
isLoading: true,
isSuccess: false,
}
} else {
return {
plan: currentOrg?.plan,
usageBillingEnabled: currentOrg?.usage_billing_enabled,
isLoading: false,
isSuccess: true,
}
}
}