export async function checkIsLoginSuccess()

in src/commands/utils.ts [105:135]


export async function checkIsLoginSuccess(): Promise<boolean> {
  const cliConfig = getCliConfig();
  const namedCommand = chalk.green('esa login');
  if (!cliConfig || !cliConfig.auth) {
    return false;
  }
  if (!cliConfig.auth.accessKeyId || !cliConfig.auth.accessKeySecret) {
    logger.log(
      `❌ ${t('utils_login_error').d('Maybe you are not logged in yet.')}`
    );
    logger.log(
      `🔔 ${t('utils_login_error_config', { namedCommand }).d(`Please run command to login: ${namedCommand}`)}`
    );
    return false;
  }
  const server = await ApiService.getInstance();
  server.updateConfig(cliConfig);
  const res = await server.checkLogin();

  if (res.success) {
    return true;
  }
  logger.log(res.message || '');
  logger.log(
    `❌ ${t('utils_login_error').d('Maybe you are not logged in yet.')}`
  );
  logger.log(
    `🔔 ${t('utils_login_error_config', { namedCommand }).d(`Please run command to login: ${namedCommand}`)}`
  );
  return false;
}