11import { Command } from '@contentstack/cli-command' ;
2- import { cliux , logger , printFlagDeprecation , args as _args , flags as _flags } from '@contentstack/cli-utilities' ;
2+ import {
3+ cliux ,
4+ logger ,
5+ printFlagDeprecation ,
6+ args as _args ,
7+ flags as _flags ,
8+ authHandler ,
9+ } from '@contentstack/cli-utilities' ;
310import { Region } from '../../../interfaces' ;
411import { regionHandler , interactive } from '../../../utils' ;
512
@@ -68,6 +75,7 @@ export default class RegionSetCommand extends Command {
6875 try {
6976 let customRegion : Region = { cda, cma, uiHost, name } ;
7077 customRegion = regionHandler . setCustomRegion ( customRegion ) ;
78+ await authHandler . setConfigData ( 'logout' ) ; //Todo: Handle this logout flow well through logout command call
7179 cliux . success ( `Custom region has been set to ${ customRegion . name } ` ) ;
7280 cliux . success ( `CMA HOST: ${ customRegion . cma } ` ) ;
7381 cliux . success ( `CDA HOST: ${ customRegion . cda } ` ) ;
@@ -78,6 +86,7 @@ export default class RegionSetCommand extends Command {
7886 }
7987 } else if ( [ 'NA' , 'EU' , 'AZURE-NA' ] . includes ( selectedRegion ) ) {
8088 const regionDetails : Region = regionHandler . setRegion ( selectedRegion ) ;
89+ await authHandler . setConfigData ( 'logout' ) ; //Todo: Handle this logout flow well through logout command call
8190 cliux . success ( `Region has been set to ${ regionDetails . name } ` ) ;
8291 cliux . success ( `CDA HOST: ${ regionDetails . cda } ` ) ;
8392 cliux . success ( `CMA HOST: ${ regionDetails . cma } ` ) ;
0 commit comments