1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: strategyId in edit strategy API command endpoint (#3725)

Fixes a small issue where the "API Command" for edit strategy was
showing the strategyId as `undefined`:


`/api/admin/projects/demo-app/features/demoApp.step1/environments/dev/strategies/undefined'`


![image](https://github.com/Unleash/unleash/assets/14320932/19650a15-5cde-43c3-9d2b-a7e790bea0ac)
This commit is contained in:
Nuno Góis 2023-05-09 14:39:28 +01:00 committed by GitHub
parent 72eba37cec
commit 8746cb1f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -31,12 +31,13 @@ test('formatUpdateStrategyApiCode', () => {
'projectId',
'featureId',
'environmentId',
'strategyId',
strategy,
strategyDefinition,
'unleashUrl'
)
).toMatchInlineSnapshot(`
"curl --location --request PUT 'unleashUrl/api/admin/projects/projectId/features/featureId/environments/environmentId/strategies/a' \\\\
"curl --location --request PUT 'unleashUrl/api/admin/projects/projectId/features/featureId/environments/environmentId/strategies/strategyId' \\\\
--header 'Authorization: INSERT_API_KEY' \\\\
--header 'Content-Type: application/json' \\\\
--data-raw '{

View File

@ -213,6 +213,7 @@ export const FeatureStrategyEdit = () => {
projectId,
featureId,
environmentId,
strategyId,
payload,
strategyDefinition,
unleashUrl
@ -272,6 +273,7 @@ export const formatUpdateStrategyApiCode = (
projectId: string,
featureId: string,
environmentId: string,
strategyId: string,
strategy: Partial<IFeatureStrategy>,
strategyDefinition: IStrategy,
unleashUrl?: string
@ -290,7 +292,7 @@ export const formatUpdateStrategyApiCode = (
),
};
const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/environments/${environmentId}/strategies/${strategy.id}`;
const url = `${unleashUrl}/api/admin/projects/${projectId}/features/${featureId}/environments/${environmentId}/strategies/${strategyId}`;
const payload = JSON.stringify(sortedStrategy, undefined, 2);
return `curl --location --request PUT '${url}' \\