mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-25 22:33:52 +03:00
side menu bug fixed && current user switch fixed
This commit is contained in:
parent
98d2351aff
commit
b6825a4416
@ -36,7 +36,7 @@ class SideMenuContainer extends Component {
|
||||
userData.forEach((element) => {
|
||||
accounts.push({
|
||||
name: `@${element.username}`,
|
||||
username: element.username
|
||||
username: element.username,
|
||||
});
|
||||
});
|
||||
accounts.push({
|
||||
@ -58,14 +58,15 @@ class SideMenuContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_switchAccount = (username = null) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
username = username.slice(1);
|
||||
switchAccount(username).then((accountData) => {
|
||||
dispatch(updateCurrentAccount(accountData));
|
||||
dispatch(openPinCodeModal());
|
||||
});
|
||||
_switchAccount = (anchor = null) => {
|
||||
const { dispatch, currentAccount } = this.props;
|
||||
const username = anchor.slice(1);
|
||||
if (username !== currentAccount.name) {
|
||||
switchAccount(username).then((accountData) => {
|
||||
dispatch(updateCurrentAccount(accountData));
|
||||
dispatch(openPinCodeModal());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -67,6 +67,8 @@ export const Login = (username, password) => {
|
||||
accessToken: '',
|
||||
};
|
||||
|
||||
account.local = userData;
|
||||
|
||||
// Save user data to Realm DB
|
||||
setUserData(userData)
|
||||
.then(() => {
|
||||
|
@ -112,11 +112,10 @@ class ApplicationContainer extends Component {
|
||||
};
|
||||
|
||||
_getSettings = () => {
|
||||
const { dispatch, isLoggedIn } = this.props;
|
||||
const { dispatch } = this.props;
|
||||
|
||||
getSettings().then((response) => {
|
||||
if (response) {
|
||||
console.log(response);
|
||||
response.isDarkTheme && dispatch(isDarkTheme(response.isDarkTheme));
|
||||
response.language && dispatch(setLanguage(response.language));
|
||||
response.currency && dispatch(setCurrency(response.currency));
|
||||
|
@ -7,9 +7,9 @@ import { setUserDataWithPinCode, verifyPinCode } from '../../../providers/steem/
|
||||
|
||||
// Actions & Services
|
||||
import { closePinCodeModal } from '../../../redux/actions/applicationActions';
|
||||
import { getExistUser, setExistUser, getUserData } from '../../../realm/realm';
|
||||
import { getExistUser, setExistUser, getUserData, getUserDataWithUsername } from '../../../realm/realm';
|
||||
import { updateCurrentAccount } from '../../../redux/actions/accountAction';
|
||||
import {formatAccount } from "../../../utils/user";
|
||||
import { formatAccount } from '../../../utils/user';
|
||||
import { PinCodeScreen } from '..';
|
||||
|
||||
class PinCodeContainer extends Component {
|
||||
@ -78,6 +78,13 @@ class PinCodeContainer extends Component {
|
||||
.then((res) => {
|
||||
setWrappedComponentState(res);
|
||||
dispatch(closePinCodeModal());
|
||||
|
||||
const realmData = getUserDataWithUsername(currentAccount.name);
|
||||
const _currentAccount = currentAccount;
|
||||
_currentAccount.username = _currentAccount.name;
|
||||
_currentAccount.local = realmData[0];
|
||||
dispatch(updateCurrentAccount({ ..._currentAccount }));
|
||||
|
||||
if (navigateTo) {
|
||||
navigation.navigate(navigateTo);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user