From e2554884bedda6492450d53f395fc21f469b9421 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Thu, 11 Jul 2019 11:57:36 +0300 Subject: [PATCH] Refactoring for application container --- .../container/applicationContainer.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 0ca22392c..2a5e26b17 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -70,7 +70,7 @@ import { isDefaultFooter, } from '../../../redux/actions/applicationActions'; -// Container +// Screens import ApplicationScreen from '../screen/applicationScreen'; import { Launch } from '../..'; @@ -334,14 +334,14 @@ class ApplicationContainer extends Component { }; }; - _logout = async () => { + _logout = () => { const { otherAccounts, currentAccount: { name, local }, dispatch, } = this.props; - await removeUserData(name) + removeUserData(name) .then(async () => { const _otherAccounts = otherAccounts.filter(user => user.username !== name); @@ -388,14 +388,14 @@ class ApplicationContainer extends Component { _switchAccount = async targetAccountUsername => { const { dispatch } = this.props; - await switchAccount(targetAccountUsername).then(accountData => { - const realmData = getUserDataWithUsername(targetAccountUsername); - const _currentAccount = accountData; - _currentAccount.username = accountData.name; - [_currentAccount.local] = realmData; + const accountData = await switchAccount(targetAccountUsername); - dispatch(updateCurrentAccount(_currentAccount)); - }); + const realmData = getUserDataWithUsername(targetAccountUsername); + const _currentAccount = accountData; + _currentAccount.username = accountData.name; + [_currentAccount.local] = realmData; + + dispatch(updateCurrentAccount(_currentAccount)); }; render() {