Hide reconnect action for valid broker sessions
This commit is contained in:
parent
144100993a
commit
121b0b3eb4
@ -569,6 +569,8 @@ export default function PortfolioSection() {
|
|||||||
const equityCurve = equityCurveQuery.data ?? cachedEquityCurve;
|
const equityCurve = equityCurveQuery.data ?? cachedEquityCurve;
|
||||||
const equityCurvePoints = equityCurve?.points ?? [];
|
const equityCurvePoints = equityCurve?.points ?? [];
|
||||||
const showSessionExpired = sessionExpired && isConnected;
|
const showSessionExpired = sessionExpired && isConnected;
|
||||||
|
const brokerAuthExpired = (brokerStatus?.authState || "").toUpperCase() === "EXPIRED";
|
||||||
|
const showReconnectBroker = isConnected && (showSessionExpired || brokerAuthExpired);
|
||||||
|
|
||||||
const normalizedStrategyStatus =
|
const normalizedStrategyStatus =
|
||||||
strategyStatus === "RUNNING" ? "RUNNING" : "STOPPED";
|
strategyStatus === "RUNNING" ? "RUNNING" : "STOPPED";
|
||||||
@ -681,7 +683,7 @@ export default function PortfolioSection() {
|
|||||||
setConnectPromptOpen(true);
|
setConnectPromptOpen(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (showSessionExpired || (brokerStatus?.authState || "").toUpperCase() === "EXPIRED") {
|
if (showSessionExpired || brokerAuthExpired) {
|
||||||
toast({
|
toast({
|
||||||
title: "Reconnect broker",
|
title: "Reconnect broker",
|
||||||
description: "Your Zerodha session has expired. Reconnect before starting the live strategy.",
|
description: "Your Zerodha session has expired. Reconnect before starting the live strategy.",
|
||||||
@ -890,7 +892,7 @@ export default function PortfolioSection() {
|
|||||||
: "Refresh data"}
|
: "Refresh data"}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
{isConnected ? (
|
{showReconnectBroker ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={handleReconnectClick}
|
onClick={handleReconnectClick}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user