@@ -197,6 +197,7 @@ export function ConfigMapSecretContainer({
197
197
} else {
198
198
toast . error ( `The ${ componentType } '${ data ?. name } ' has been deleted` )
199
199
update ( index , null )
200
+ redirectURLToInitial ( )
200
201
}
201
202
} else if (
202
203
cmSecretStateLabel === CM_SECRET_STATE . UNPUBLISHED &&
@@ -209,6 +210,7 @@ export function ConfigMapSecretContainer({
209
210
} else if ( _draftData . value . result . draftState === 2 ) {
210
211
toast . error ( `The ${ componentType } '${ data ?. name } ' has been deleted` )
211
212
update ( index , null )
213
+ redirectURLToInitial ( )
212
214
}
213
215
}
214
216
if (
@@ -232,7 +234,7 @@ export function ConfigMapSecretContainer({
232
234
}
233
235
}
234
236
235
- const redirectURL = ( urlTo : string = '' ) => {
237
+ const redirectURLToInitial = ( urlTo : string = '' ) => {
236
238
const componentTypeName = componentType === 'secret' ? 'secrets' : 'configmap'
237
239
const urlPrefix = match . url . split ( componentTypeName ) [ 0 ]
238
240
history . push ( `${ urlPrefix } ${ componentTypeName } /${ urlTo } ` )
@@ -244,18 +246,18 @@ export function ConfigMapSecretContainer({
244
246
if ( name === 'create' ) {
245
247
toggleDraftComments ( null )
246
248
setDraftData ( null )
247
- return redirectURL ( )
249
+ return redirectURLToInitial ( )
248
250
}
249
- return redirectURL ( 'create' )
251
+ return redirectURLToInitial ( 'create' )
250
252
} else {
251
253
//Redirect and Open existing config map & secret
252
254
if ( name === title ) {
253
255
toggleDraftComments ( null )
254
256
setDraftData ( null )
255
- return redirectURL ( )
257
+ return redirectURLToInitial ( )
256
258
} else {
257
259
getData ( )
258
- return redirectURL ( title )
260
+ return redirectURLToInitial ( title )
259
261
}
260
262
}
261
263
}
0 commit comments