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

fix: settings endpoint add basePath (#3377)

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Fix missing basePath for project settings endpoint
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
andreas-unleash 2023-03-23 16:13:28 +02:00 committed by GitHub
parent 322cbcfd6a
commit f4e0c9a905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import {
DefaultStickiness, DefaultStickiness,
ProjectMode, ProjectMode,
} from 'component/project/Project/hooks/useProjectForm'; } from 'component/project/Project/hooks/useProjectForm';
import { formatApiPath } from 'utils/formatPath';
export interface ISettingsResponse { export interface ISettingsResponse {
defaultStickiness?: DefaultStickiness; defaultStickiness?: DefaultStickiness;
@ -19,14 +20,14 @@ export const useDefaultProjectSettings = (
) => { ) => {
const { uiConfig } = useUiConfig(); const { uiConfig } = useUiConfig();
const PATH = `/api/admin/projects/${projectId}/settings`; const PATH = `api/admin/projects/${projectId}/settings`;
const { projectScopedStickiness } = uiConfig.flags; const { projectScopedStickiness } = uiConfig.flags;
const { data, error, mutate } = useConditionalSWR<ISettingsResponse>( const { data, error, mutate } = useConditionalSWR<ISettingsResponse>(
Boolean(projectId) && Boolean(projectScopedStickiness), Boolean(projectId) && Boolean(projectScopedStickiness),
{}, {},
['useDefaultProjectSettings', PATH], ['useDefaultProjectSettings', PATH],
() => fetcher(PATH), () => fetcher(formatApiPath(PATH)),
options options
); );