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 equityCurvePoints = equityCurve?.points ?? [];
|
||||
const showSessionExpired = sessionExpired && isConnected;
|
||||
const brokerAuthExpired = (brokerStatus?.authState || "").toUpperCase() === "EXPIRED";
|
||||
const showReconnectBroker = isConnected && (showSessionExpired || brokerAuthExpired);
|
||||
|
||||
const normalizedStrategyStatus =
|
||||
strategyStatus === "RUNNING" ? "RUNNING" : "STOPPED";
|
||||
@ -681,7 +683,7 @@ export default function PortfolioSection() {
|
||||
setConnectPromptOpen(true);
|
||||
return;
|
||||
}
|
||||
if (showSessionExpired || (brokerStatus?.authState || "").toUpperCase() === "EXPIRED") {
|
||||
if (showSessionExpired || brokerAuthExpired) {
|
||||
toast({
|
||||
title: "Reconnect broker",
|
||||
description: "Your Zerodha session has expired. Reconnect before starting the live strategy.",
|
||||
@ -890,7 +892,7 @@ export default function PortfolioSection() {
|
||||
: "Refresh data"}
|
||||
</Button>
|
||||
) : null}
|
||||
{isConnected ? (
|
||||
{showReconnectBroker ? (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleReconnectClick}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user