Skip to content

Commit 508b25a

Browse files
committed
fix: call delete api with updated url
1 parent b276b1e commit 508b25a

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/components/charts/charts.service.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { get, post, put, trash, sortCallback, ResponseType, getUrlWithSearchParams } from '@devtron-labs/devtron-fe-common-lib'
17+
import {
18+
get,
19+
post,
20+
put,
21+
trash,
22+
sortCallback,
23+
ResponseType,
24+
getUrlWithSearchParams,
25+
} from '@devtron-labs/devtron-fe-common-lib'
1826
import { DELETE_ACTION, Routes } from '../../config'
1927
import { getAPIOptionsWithTriggerTimeout, handleUTCTime } from '../common'
20-
import { ChartValuesType, ChartGroup, HelmTemplateChartRequest, HelmProjectUpdatePayload, DeleteInstalledChartParamsType } from './charts.types'
28+
import {
29+
ChartValuesType,
30+
ChartGroup,
31+
HelmTemplateChartRequest,
32+
HelmProjectUpdatePayload,
33+
DeleteInstalledChartParamsType,
34+
} from './charts.types'
2135
import { SavedValueListResponse } from './SavedValues/types'
2236

2337
interface RootObject {
@@ -59,19 +73,17 @@ export function deleteInstalledChart(
5973
) {
6074
const baseUrl: string = `app-store/deployment/application/delete/${installedAppId}`
6175
let params: DeleteInstalledChartParamsType = {}
62-
const url = getUrlWithSearchParams(baseUrl, params)
6376
if (deleteAction === DELETE_ACTION.FORCE_DELETE) {
6477
params = {
65-
forceDelete: true
78+
forceDelete: true,
6679
}
6780
} else if (isGitops) {
68-
deleteAction === DELETE_ACTION.NONCASCADE_DELETE ? params = {
69-
partialDelete: true,
70-
cascade: false
71-
} : params = {
72-
partialDelete: true
81+
params['partialDelete'] = true
82+
if (deleteAction === DELETE_ACTION.NONCASCADE_DELETE) {
83+
params['cascade'] = false
7384
}
7485
}
86+
const url = getUrlWithSearchParams(baseUrl, params)
7587
return trash(url)
7688
}
7789

0 commit comments

Comments
 (0)