Compare commits

..

No commits in common. "c4fa91f6ea371c9199e81d2a3534c8adb0435309" and "3674a28deed80183abbdb05226ca8f5ecdf32381" have entirely different histories.

3 changed files with 9 additions and 25 deletions

View File

@ -64,19 +64,14 @@ export const connectPortalAtom = atom(
throw err; throw err;
} }
if (!(err instanceof AbnormalPortalConfigError)) { if (err instanceof AbnormalPortalConfigError) {
throw err;
}
logger.info( logger.info(
`Got abnormal portal config: ${err.message}, retrying...` `Got abnormal portal config: ${err.message}, retrying...`
); );
set(statusAtom, "prelogin");
prelogin = await portalService.prelogin(portal); prelogin = await portalService.prelogin(portal);
const isProcessing = get(isProcessingAtom); continue;
if (!isProcessing) { } else {
logger.info("Operation cancelled"); throw err;
break;
} }
} }
} }

View File

@ -1,7 +1,6 @@
import { atom } from "jotai"; import { atom } from "jotai";
import gatewayService from "../services/gatewayService"; import gatewayService from "../services/gatewayService";
import logger from "../utils/logger"; import logger from "../utils/logger";
import { redact } from "../utils/redact";
import { isProcessingAtom, statusAtom } from "./status"; import { isProcessingAtom, statusAtom } from "./status";
import { connectVpnAtom } from "./vpn"; import { connectVpnAtom } from "./vpn";
@ -21,7 +20,7 @@ export const loginGatewayAtom = atom(
set(statusAtom, "gateway-login"); set(statusAtom, "gateway-login");
let token: string; let token: string;
try { try {
logger.info(`Logging in to gateway ${redact(gateway)}...`); logger.info(`Logging in to gateway ${gateway}...`);
token = await gatewayService.login(gateway, credential); token = await gatewayService.login(gateway, credential);
} catch (err) { } catch (err) {
throw new Error("Failed to login to gateway"); throw new Error("Failed to login to gateway");

View File

@ -80,12 +80,6 @@ export const loginPortalAtom = atom(
throw new AbnormalPortalConfigError("Empty user auth cookie"); throw new AbnormalPortalConfigError("Empty user auth cookie");
} }
logger.info(
`Retrieved ${gateways.length} gateways, userAuthCookie: ${redact(
userAuthCookie
)}, prelogonUserAuthCookie: ${redact(prelogonUserAuthCookie)}`
);
// Here, we have got the portal config successfully, refresh the cached portal data // Here, we have got the portal config successfully, refresh the cached portal data
const previousSelectedGateway = get(selectedGatewayAtom)?.name; const previousSelectedGateway = get(selectedGatewayAtom)?.name;
const selectedGateway = gateways.find( const selectedGateway = gateways.find(
@ -112,11 +106,7 @@ export const loginPortalAtom = atom(
preferredGateway: previousSelectedGateway, preferredGateway: previousSelectedGateway,
}); });
logger.info( logger.info(`Found the preferred gateway: ${name} (${redact(address)})`);
`Found the preferred gateway: ${name} (${redact(
address
)}) for region: ${region}`
);
// Log in to the gateway // Log in to the gateway
await set(loginGatewayAtom, address, { await set(loginGatewayAtom, address, {