mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
fix(console): add dev guard on new pricing model subscription hooks (#6363)
This commit is contained in:
parent
40a8a9a9bb
commit
4abe2a8473
3 changed files with 11 additions and 7 deletions
|
@ -2,13 +2,13 @@ import useSWR from 'swr';
|
|||
|
||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||
import { type NewSubscriptionQuota } from '@/cloud/types/router';
|
||||
import { isCloud } from '@/consts/env';
|
||||
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||
|
||||
const useNewSubscriptionQuota = (tenantId: string) => {
|
||||
const cloudApi = useCloudApi();
|
||||
|
||||
return useSWR<NewSubscriptionQuota, Error>(
|
||||
isCloud && `/api/tenants/${tenantId}/subscription/quota`,
|
||||
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/quota`,
|
||||
async () =>
|
||||
cloudApi.get('/api/tenants/:tenantId/subscription/quota', {
|
||||
params: { tenantId },
|
||||
|
|
|
@ -2,7 +2,7 @@ import useSWR from 'swr';
|
|||
|
||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||
import { type NewSubscriptionScopeUsage } from '@/cloud/types/router';
|
||||
import { isCloud } from '@/consts/env';
|
||||
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||
|
||||
const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
||||
const cloudApi = useCloudApi();
|
||||
|
@ -12,7 +12,9 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
|||
|
||||
return {
|
||||
scopeResourceUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
||||
isCloud && `/api/tenants/${tenantId}/subscription/usage/${resourceEntityName}/scopes`,
|
||||
isCloud &&
|
||||
isDevFeaturesEnabled &&
|
||||
`/api/tenants/${tenantId}/subscription/usage/${resourceEntityName}/scopes`,
|
||||
async () =>
|
||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
||||
params: { tenantId, entityName: resourceEntityName },
|
||||
|
@ -20,7 +22,9 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
|||
})
|
||||
),
|
||||
scopeRoleUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
||||
isCloud && `/api/tenants/${tenantId}/subscription/usage/${roleEntityName}/scopes`,
|
||||
isCloud &&
|
||||
isDevFeaturesEnabled &&
|
||||
`/api/tenants/${tenantId}/subscription/usage/${roleEntityName}/scopes`,
|
||||
async () =>
|
||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
||||
params: { tenantId, entityName: roleEntityName },
|
||||
|
|
|
@ -2,13 +2,13 @@ import useSWR from 'swr';
|
|||
|
||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||
import { type NewSubscriptionUsage } from '@/cloud/types/router';
|
||||
import { isCloud } from '@/consts/env';
|
||||
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||
|
||||
const useNewSubscriptionUsage = (tenantId: string) => {
|
||||
const cloudApi = useCloudApi();
|
||||
|
||||
return useSWR<NewSubscriptionUsage, Error>(
|
||||
isCloud && `/api/tenants/${tenantId}/subscription/usage`,
|
||||
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/usage`,
|
||||
async () =>
|
||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage', {
|
||||
params: { tenantId },
|
||||
|
|
Loading…
Add table
Reference in a new issue