Skip to content

Commit cf1435a

Browse files
authored
Merge pull request #727 from contentstack/refactor/cs-37686
Refactor/cs 37686
2 parents e3954c0 + 70c7e35 commit cf1435a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • packages/contentstack-config/src/commands/config/set

packages/contentstack-config/src/commands/config/set/region.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { 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';
310
import { Region } from '../../../interfaces';
411
import { 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

Comments
 (0)