mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -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 { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||||
import { type NewSubscriptionQuota } from '@/cloud/types/router';
|
import { type NewSubscriptionQuota } from '@/cloud/types/router';
|
||||||
import { isCloud } from '@/consts/env';
|
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||||
|
|
||||||
const useNewSubscriptionQuota = (tenantId: string) => {
|
const useNewSubscriptionQuota = (tenantId: string) => {
|
||||||
const cloudApi = useCloudApi();
|
const cloudApi = useCloudApi();
|
||||||
|
|
||||||
return useSWR<NewSubscriptionQuota, Error>(
|
return useSWR<NewSubscriptionQuota, Error>(
|
||||||
isCloud && `/api/tenants/${tenantId}/subscription/quota`,
|
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/quota`,
|
||||||
async () =>
|
async () =>
|
||||||
cloudApi.get('/api/tenants/:tenantId/subscription/quota', {
|
cloudApi.get('/api/tenants/:tenantId/subscription/quota', {
|
||||||
params: { tenantId },
|
params: { tenantId },
|
||||||
|
|
|
@ -2,7 +2,7 @@ import useSWR from 'swr';
|
||||||
|
|
||||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||||
import { type NewSubscriptionScopeUsage } from '@/cloud/types/router';
|
import { type NewSubscriptionScopeUsage } from '@/cloud/types/router';
|
||||||
import { isCloud } from '@/consts/env';
|
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||||
|
|
||||||
const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
||||||
const cloudApi = useCloudApi();
|
const cloudApi = useCloudApi();
|
||||||
|
@ -12,7 +12,9 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
scopeResourceUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
scopeResourceUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
||||||
isCloud && `/api/tenants/${tenantId}/subscription/usage/${resourceEntityName}/scopes`,
|
isCloud &&
|
||||||
|
isDevFeaturesEnabled &&
|
||||||
|
`/api/tenants/${tenantId}/subscription/usage/${resourceEntityName}/scopes`,
|
||||||
async () =>
|
async () =>
|
||||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
||||||
params: { tenantId, entityName: resourceEntityName },
|
params: { tenantId, entityName: resourceEntityName },
|
||||||
|
@ -20,7 +22,9 @@ const useNewSubscriptionScopeUsage = (tenantId: string) => {
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
scopeRoleUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
scopeRoleUsage: useSWR<NewSubscriptionScopeUsage, Error>(
|
||||||
isCloud && `/api/tenants/${tenantId}/subscription/usage/${roleEntityName}/scopes`,
|
isCloud &&
|
||||||
|
isDevFeaturesEnabled &&
|
||||||
|
`/api/tenants/${tenantId}/subscription/usage/${roleEntityName}/scopes`,
|
||||||
async () =>
|
async () =>
|
||||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
cloudApi.get('/api/tenants/:tenantId/subscription/usage/:entityName/scopes', {
|
||||||
params: { tenantId, entityName: roleEntityName },
|
params: { tenantId, entityName: roleEntityName },
|
||||||
|
|
|
@ -2,13 +2,13 @@ import useSWR from 'swr';
|
||||||
|
|
||||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||||
import { type NewSubscriptionUsage } from '@/cloud/types/router';
|
import { type NewSubscriptionUsage } from '@/cloud/types/router';
|
||||||
import { isCloud } from '@/consts/env';
|
import { isCloud, isDevFeaturesEnabled } from '@/consts/env';
|
||||||
|
|
||||||
const useNewSubscriptionUsage = (tenantId: string) => {
|
const useNewSubscriptionUsage = (tenantId: string) => {
|
||||||
const cloudApi = useCloudApi();
|
const cloudApi = useCloudApi();
|
||||||
|
|
||||||
return useSWR<NewSubscriptionUsage, Error>(
|
return useSWR<NewSubscriptionUsage, Error>(
|
||||||
isCloud && `/api/tenants/${tenantId}/subscription/usage`,
|
isCloud && isDevFeaturesEnabled && `/api/tenants/${tenantId}/subscription/usage`,
|
||||||
async () =>
|
async () =>
|
||||||
cloudApi.get('/api/tenants/:tenantId/subscription/usage', {
|
cloudApi.get('/api/tenants/:tenantId/subscription/usage', {
|
||||||
params: { tenantId },
|
params: { tenantId },
|
||||||
|
|
Loading…
Add table
Reference in a new issue