From 5725a87887e5ab20f658e4be6b9c2296de71e06d Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Tue, 5 Apr 2022 14:41:16 +0300 Subject: [PATCH] Web: Client: Settings: use data from store --- .../categories/security/access-portal/tfa.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/tfa.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/tfa.js index 6449eabff0..b88665ba66 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/tfa.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/tfa.js @@ -33,15 +33,13 @@ const TwoFactorAuth = (props) => { const [showReminder, setShowReminder] = useState(false); const [isLoading, setIsLoading] = useState(false); - const getSettings = async () => { - const { getTfaType, getTfaSettings } = props; - const type = await getTfaType(); - setType(type); - setCurrentState(type); + const getSettings = () => { + const { tfaSettings, smsAvailable, appAvailable } = props; - const settings = await getTfaSettings(); - setSmsDisabled(settings[0].avaliable); - setAppDisabled(settings[1].avaliable); + setType(tfaSettings); + setCurrentState(tfaSettings); + setSmsDisabled(smsAvailable); + setAppDisabled(appAvailable); setIsLoading(true); }; @@ -142,20 +140,20 @@ const TwoFactorAuth = (props) => { }; export default inject(({ auth }) => { - const { organizationName } = auth.settingsStore; const { - getTfaType, - getTfaSettings, setTfaSettings, getTfaConfirmLink, + tfaSettings, + smsAvailable, + appAvailable, } = auth.tfaStore; return { - organizationName, - getTfaType, - getTfaSettings, setTfaSettings, getTfaConfirmLink, + tfaSettings, + smsAvailable, + appAvailable, }; })( withTranslation(["Settings", "Common"])(withRouter(observer(TwoFactorAuth)))