From 071feb02f973bb24b54bca9e67a58c52a98aa910 Mon Sep 17 00:00:00 2001 From: Eduard Gert Date: Fri, 1 Mar 2024 17:01:26 +0100 Subject: [PATCH] Fix SSO expiration dropdown to reflect the actual "Hours" or "Days" (#345) --- src/modules/settings/AuthenticationTab.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/settings/AuthenticationTab.tsx b/src/modules/settings/AuthenticationTab.tsx index 1f7b08f..a924cef 100644 --- a/src/modules/settings/AuthenticationTab.tsx +++ b/src/modules/settings/AuthenticationTab.tsx @@ -56,7 +56,9 @@ export default function AuthenticationTab({ account }: Props) { account.settings.peer_login_expiration || 86400, ); const [expiresIn, setExpiresIn] = useState(() => { - if (expiresInSeconds <= 86400) return "1"; + if (expiresInSeconds <= 86400) { + return Math.round(expiresInSeconds / 3600).toString(); + } return Math.round(expiresInSeconds / 86400).toString(); }); @@ -64,7 +66,7 @@ export default function AuthenticationTab({ account }: Props) { * Interval */ const initialInterval = useMemo(() => { - if (Number(expiresIn) <= 86400) return "hours"; + if (expiresInSeconds <= 86400) return "hours"; return "days"; // eslint-disable-next-line react-hooks/exhaustive-deps }, []);