Eslint errors fixed for application container

This commit is contained in:
Mustafa Buyukcelebi 2018-12-25 15:15:32 +03:00
parent 20d5c95a44
commit f31a0f2607

View File

@ -93,23 +93,21 @@ class ApplicationContainer extends Component {
_getUserData = async () => {
const { dispatch } = this.props;
let realmData;
let authStatus;
let currentUsername;
await getAuthStatus().then((res) => {
authStatus = res;
currentUsername = res.currentUsername;
({ currentUsername } = res);
if (res) {
getUserData().then((userData) => {
if (userData.length > 0) {
realmData = userData;
userData.forEach((accountData) => {
dispatch(
addOtherAccount({ username: accountData.username }),
);
dispatch(addOtherAccount({ username: accountData.username }));
});
}
});
}
});
if (realmData) {
@ -118,10 +116,11 @@ class ApplicationContainer extends Component {
dispatch(login(true));
const realmObject = realmData.filter(data => data.username === currentUsername);
accountData.local = realmObject[0];
[accountData.local] = realmObject;
dispatch(updateCurrentAccount(accountData));
// If in dev mode pin code does not show
// eslint-disable-next-line
if (__DEV__ === false) {
dispatch(openPinCodeModal());
}
@ -142,12 +141,12 @@ class ApplicationContainer extends Component {
getSettings().then((response) => {
if (response) {
response.isDarkTheme && dispatch(isDarkTheme(response.isDarkTheme));
response.language && dispatch(setLanguage(response.language));
response.currency && dispatch(setCurrency(response.currency));
response.notification && dispatch(isNotificationOpen(response.notification));
response.server && dispatch(setApi(response.server));
response.upvotePercent && dispatch(setUpvotePercent(Number(response.upvotePercent)));
if (response.isDarkTheme) dispatch(isDarkTheme(response.isDarkTheme));
if (response.language) dispatch(setLanguage(response.language));
if (response.currency) dispatch(setCurrency(response.currency));
if (response.notification) dispatch(isNotificationOpen(response.notification));
if (response.server) dispatch(setApi(response.server));
if (response.upvotePercent) dispatch(setUpvotePercent(Number(response.upvotePercent)));
this.setState({ isReady: true });
}
@ -158,7 +157,7 @@ class ApplicationContainer extends Component {
const { dispatch, unreadActivityCount } = this.props;
const ws = new WebSocket(`${Config.ACTIVITY_WEBSOCKET_URL}?user=${username}`);
ws.onmessage = (e) => {
ws.onmessage = () => {
// a message was received
dispatch(updateUnreadActivityCount(unreadActivityCount + 1));
};
@ -188,9 +187,7 @@ class ApplicationContainer extends Component {
};
_logout = () => {
const {
otherAccounts, currentAccountUsername, dispatch,
} = this.props;
const { otherAccounts, currentAccountUsername, dispatch } = this.props;
removeUserData(currentAccountUsername)
.then(() => {
@ -210,8 +207,7 @@ class ApplicationContainer extends Component {
dispatch(removeOtherAccount(currentAccountUsername));
dispatch(logoutDone());
})
.catch((err) => {
alert('err');
.catch(() => {
});
};
@ -222,11 +218,11 @@ class ApplicationContainer extends Component {
const realmData = getUserDataWithUsername(targetAccountUsername);
const _currentAccount = accountData;
_currentAccount.username = accountData.name;
_currentAccount.local = realmData[0];
[_currentAccount.local] = realmData;
dispatch(updateCurrentAccount(_currentAccount));
});
}
};
render() {
const { selectedLanguage } = this.props;