mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-17 13:46:47 +02: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:
parent
816c8dbb46
commit
d821b1ead1
@ -1,5 +1,6 @@
|
|||||||
import { FeaturesSchema } from 'openapi';
|
import { FeaturesSchema } from 'openapi';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||||
|
|
||||||
const fetcher = (path: string) => {
|
const fetcher = (path: string) => {
|
||||||
@ -10,7 +11,7 @@ const fetcher = (path: string) => {
|
|||||||
|
|
||||||
export const useFeatures = () => {
|
export const useFeatures = () => {
|
||||||
const { data, error, mutate } = useSWR<FeaturesSchema>(
|
const { data, error, mutate } = useSWR<FeaturesSchema>(
|
||||||
'api/admin/features',
|
formatApiPath('api/admin/features'),
|
||||||
fetcher,
|
fetcher,
|
||||||
{
|
{
|
||||||
refreshInterval: 15 * 1000, // ms
|
refreshInterval: 15 * 1000, // ms
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
import { FeatureSchema, FeaturesSchema } from 'openapi';
|
import { FeatureSchema, FeaturesSchema } from 'openapi';
|
||||||
import handleErrorResponses from '../httpErrorResponseHandler';
|
import handleErrorResponses from '../httpErrorResponseHandler';
|
||||||
|
import { formatApiPath } from 'utils/formatPath';
|
||||||
|
|
||||||
export interface IUseFeaturesArchiveOutput {
|
export interface IUseFeaturesArchiveOutput {
|
||||||
archivedFeatures?: FeatureSchema[];
|
archivedFeatures?: FeatureSchema[];
|
||||||
@ -19,9 +20,11 @@ export const useFeaturesArchive = (
|
|||||||
projectId?: string
|
projectId?: string
|
||||||
): IUseFeaturesArchiveOutput => {
|
): IUseFeaturesArchiveOutput => {
|
||||||
const { data, error, mutate, isLoading } = useSWR<FeaturesSchema>(
|
const { data, error, mutate, isLoading } = useSWR<FeaturesSchema>(
|
||||||
|
formatApiPath(
|
||||||
projectId
|
projectId
|
||||||
? `/api/admin/archive/features/${projectId}`
|
? `/api/admin/archive/features/${projectId}`
|
||||||
: 'api/admin/features',
|
: 'api/admin/features'
|
||||||
|
),
|
||||||
fetcher,
|
fetcher,
|
||||||
{
|
{
|
||||||
refreshInterval: 15 * 1000, // ms
|
refreshInterval: 15 * 1000, // ms
|
||||||
|
Loading…
Reference in New Issue
Block a user