From f4201f2c3f59ff73a0a03911f832e8b65c7aee1f Mon Sep 17 00:00:00 2001 From: Proxwian Date: Thu, 29 Feb 2024 22:06:31 +0300 Subject: [PATCH] implement account add from modal --- src/common/modals/AddAccount.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/common/modals/AddAccount.js b/src/common/modals/AddAccount.js index 8a03efe05..ae8fa3084 100644 --- a/src/common/modals/AddAccount.js +++ b/src/common/modals/AddAccount.js @@ -7,7 +7,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import Modal from '../components/Modal'; import { load } from '../reducers/loading/actions'; import features from '../reducers/loading/features'; -import { login, loginOAuth } from '../reducers/actions'; +import { login, loginElyBy, loginOAuth, loginOffline, loginOx } from '../reducers/actions'; import { closeModal } from '../reducers/modals/actions'; import { shell } from 'electron'; import { ACCOUNT_ELYBY, ACCOUNT_MICROSOFT, ACCOUNT_OFFLINE, ACCOUNT_OXAUTH, OXAUTH_REGISTER_URL, ELYBY_REGISTER_URL } from '../utils/constants'; @@ -21,7 +21,23 @@ const AddAccount = ({ username }) => { const addOfflineAccount = () => { dispatch( - load(features.mcAuthentication, dispatch(login(email, password, false))) + load(features.mcAuthentication, dispatch(loginOffline(email, false))) + ) + .then(() => dispatch(closeModal())) + .catch(console.error); + }; + + const addElyByAccount = () => { + dispatch( + load(features.mcAuthentication, dispatch(loginElyBy(email, password, false))) + ) + .then(() => dispatch(closeModal())) + .catch(console.error); + }; + + const addOxAccount = () => { + dispatch( + load(features.mcAuthentication, dispatch(loginOx(email, password, false))) ) .then(() => dispatch(closeModal())) .catch(console.error); @@ -83,7 +99,7 @@ const AddAccount = ({ username }) => { /> - Добавить + Добавить Регистрация @@ -113,7 +129,7 @@ const AddAccount = ({ username }) => { /> - Добавить + Добавить Регистрация