From 883e59a5a35d1aa5d13c8865a2455339f385621a Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 14 Mar 2022 11:26:06 +0100 Subject: [PATCH] Remove "Revoke Refresh Token" when not revoke on (#2234) --- src/realm-settings/TokensTab.tsx | 62 ++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/src/realm-settings/TokensTab.tsx b/src/realm-settings/TokensTab.tsx index e8f40461a3..8cd1c534c9 100644 --- a/src/realm-settings/TokensTab.tsx +++ b/src/realm-settings/TokensTab.tsx @@ -75,6 +75,12 @@ export const RealmSettingsTokensTab = ({ defaultValue: 36000, }); + const revokeRefreshToken = useWatch({ + control, + name: "revokeRefreshToken", + defaultValue: false, + }); + return ( - - } - fieldId="refreshTokenMaxReuse" - > - ( - onChange(value + 1)} - onMinus={() => onChange(value - 1)} - onChange={(event) => - onChange(Number((event.target as HTMLInputElement).value)) - } + {revokeRefreshToken && ( + - )} - /> - + } + fieldId="refreshTokenMaxReuse" + > + ( + onChange(value + 1)} + onMinus={() => onChange(value - 1)} + onChange={(event) => + onChange(Number((event.target as HTMLInputElement).value)) + } + /> + )} + /> + + )}