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

View File

@ -1,7 +1,6 @@
import { atom } from "jotai";
import gatewayService from "../services/gatewayService";
import logger from "../utils/logger";
import { redact } from "../utils/redact";
import { isProcessingAtom, statusAtom } from "./status";
import { connectVpnAtom } from "./vpn";
@ -21,7 +20,7 @@ export const loginGatewayAtom = atom(
set(statusAtom, "gateway-login");
let token: string;
try {
logger.info(`Logging in to gateway ${redact(gateway)}...`);
logger.info(`Logging in to gateway ${gateway}...`);
token = await gatewayService.login(gateway, credential);
} catch (err) {
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");
}
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
const previousSelectedGateway = get(selectedGatewayAtom)?.name;
const selectedGateway = gateways.find(
@ -112,11 +106,7 @@ export const loginPortalAtom = atom(
preferredGateway: previousSelectedGateway,
});
logger.info(
`Found the preferred gateway: ${name} (${redact(
address
)}) for region: ${region}`
);
logger.info(`Found the preferred gateway: ${name} (${redact(address)})`);
// Log in to the gateway
await set(loginGatewayAtom, address, {