Skip to content

Commit ec32e46

Browse files
committed
redirection of delelete to initials
1 parent b18441a commit ec32e46

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/ConfigMapSecret/ConfigMapSecret.components.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export function ConfigMapSecretContainer({
197197
} else {
198198
toast.error(`The ${componentType} '${data?.name}' has been deleted`)
199199
update(index, null)
200+
redirectURLToInitial()
200201
}
201202
} else if (
202203
cmSecretStateLabel === CM_SECRET_STATE.UNPUBLISHED &&
@@ -209,6 +210,7 @@ export function ConfigMapSecretContainer({
209210
} else if (_draftData.value.result.draftState === 2) {
210211
toast.error(`The ${componentType} '${data?.name}' has been deleted`)
211212
update(index, null)
213+
redirectURLToInitial()
212214
}
213215
}
214216
if (
@@ -232,7 +234,7 @@ export function ConfigMapSecretContainer({
232234
}
233235
}
234236

235-
const redirectURL = (urlTo: string = '') => {
237+
const redirectURLToInitial = (urlTo: string = '') => {
236238
const componentTypeName = componentType === 'secret' ? 'secrets' : 'configmap'
237239
const urlPrefix = match.url.split(componentTypeName)[0]
238240
history.push(`${urlPrefix}${componentTypeName}/${urlTo}`)
@@ -244,18 +246,18 @@ export function ConfigMapSecretContainer({
244246
if (name === 'create') {
245247
toggleDraftComments(null)
246248
setDraftData(null)
247-
return redirectURL()
249+
return redirectURLToInitial()
248250
}
249-
return redirectURL('create')
251+
return redirectURLToInitial('create')
250252
} else {
251253
//Redirect and Open existing config map & secret
252254
if (name === title) {
253255
toggleDraftComments(null)
254256
setDraftData(null)
255-
return redirectURL()
257+
return redirectURLToInitial()
256258
} else {
257259
getData()
258-
return redirectURL(title)
260+
return redirectURLToInitial(title)
259261
}
260262
}
261263
}

0 commit comments

Comments
 (0)