1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: missing formatApiPath (#3006)

## About the changes
Archive page is not loading archived feature toggles.

When fetching from the server is not including the baseUrl
This commit is contained in:
Gastón Fournier 2023-01-27 11:18:32 +01:00 committed by GitHub
parent 816c8dbb46
commit d821b1ead1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import { FeaturesSchema } from 'openapi';
import useSWR from 'swr';
import { formatApiPath } from 'utils/formatPath';
import handleErrorResponses from '../httpErrorResponseHandler';
const fetcher = (path: string) => {
@ -10,7 +11,7 @@ const fetcher = (path: string) => {
export const useFeatures = () => {
const { data, error, mutate } = useSWR<FeaturesSchema>(
'api/admin/features',
formatApiPath('api/admin/features'),
fetcher,
{
refreshInterval: 15 * 1000, // ms

View File

@ -1,6 +1,7 @@
import useSWR from 'swr';
import { FeatureSchema, FeaturesSchema } from 'openapi';
import handleErrorResponses from '../httpErrorResponseHandler';
import { formatApiPath } from 'utils/formatPath';
export interface IUseFeaturesArchiveOutput {
archivedFeatures?: FeatureSchema[];
@ -19,9 +20,11 @@ export const useFeaturesArchive = (
projectId?: string
): IUseFeaturesArchiveOutput => {
const { data, error, mutate, isLoading } = useSWR<FeaturesSchema>(
formatApiPath(
projectId
? `/api/admin/archive/features/${projectId}`
: 'api/admin/features',
: 'api/admin/features'
),
fetcher,
{
refreshInterval: 15 * 1000, // ms