0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

Revert "refactor(console): replace get sku api" (#6868)

Revert "refactor(console): replace get sku api (#6861)"

This reverts commit 51c9c52a61.
This commit is contained in:
simeng-li 2024-12-10 15:31:20 +08:00 committed by GitHub
parent 8a15a60c37
commit ba84b1aed8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
import { type Optional } from '@silverhand/essentials';
import { useContext, useMemo } from 'react';
import { useMemo } from 'react';
import useSWRImmutable from 'swr/immutable';
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
@ -9,7 +9,6 @@ import { featuredPlanIdOrder } from '@/consts/subscriptions';
// Used in the docs
// eslint-disable-next-line unused-imports/no-unused-imports
import TenantAccess from '@/containers/TenantAccess';
import { TenantsContext } from '@/contexts/TenantsProvider';
import { LogtoSkuType } from '@/types/skus';
import { sortBy } from '@/utils/sort';
import { addSupportQuota } from '@/utils/subscription';
@ -20,13 +19,11 @@ import { addSupportQuota } from '@/utils/subscription';
*/
const useLogtoSkus = () => {
const cloudApi = useCloudApi();
const { currentTenantId } = useContext(TenantsContext);
const useSwrResponse = useSWRImmutable<LogtoSkuResponse[], Error>(
isCloud && currentTenantId && `/api/tenants/${currentTenantId}/available-skus`,
isCloud && '/api/skus',
async () =>
cloudApi.get('/api/tenants/:tenantId/available-skus', {
params: { tenantId: currentTenantId },
cloudApi.get('/api/skus', {
search: { type: LogtoSkuType.Basic },
})
);