mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-28 18:32:36 +03:00
fixed #194
This commit is contained in:
parent
4f2d8b9f5f
commit
fdb9f8b035
@ -73,6 +73,7 @@ export const Login = (username, password) => {
|
||||
setUserData(userData)
|
||||
.then(() => {
|
||||
resolve({ ...account, password });
|
||||
updateCurrentUsername(account.name);
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('Invalid credentails, please check and try again'));
|
||||
@ -127,6 +128,7 @@ export const loginWithSC2 = async (accessToken) => {
|
||||
.then(() => {
|
||||
account.account.username = account.account.name;
|
||||
resolve({ ...account.account, accessToken });
|
||||
updateCurrentUsername(account.account.name);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
|
@ -56,13 +56,14 @@ class ApplicationContainer extends Component {
|
||||
super();
|
||||
this.state = {
|
||||
isRenderRequire: true,
|
||||
isReady: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount = async () => {
|
||||
BackHandler.addEventListener('hardwareBackPress', this._onBackPress);
|
||||
await this._getUserData();
|
||||
this._getSettings();
|
||||
await this._getSettings();
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -146,6 +147,8 @@ class ApplicationContainer extends Component {
|
||||
response.notification && dispatch(isNotificationOpen(response.notification));
|
||||
response.server && dispatch(setApi(response.server));
|
||||
response.upvotePercent && dispatch(setUpvotePercent(Number(response.upvotePercent)));
|
||||
|
||||
this.setState({isReady: true});
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -226,14 +229,14 @@ class ApplicationContainer extends Component {
|
||||
|
||||
render() {
|
||||
const { selectedLanguage } = this.props;
|
||||
const { isRenderRequire } = this.state;
|
||||
const { isRenderRequire, isReady } = this.state;
|
||||
|
||||
const locale = (navigator.languages && navigator.languages[0])
|
||||
|| navigator.language
|
||||
|| navigator.userLanguage
|
||||
|| selectedLanguage;
|
||||
|
||||
if (isRenderRequire) {
|
||||
if (isRenderRequire && isReady) {
|
||||
return <ApplicationScreen locale={locale} {...this.props} />;
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user