implement login fixed bugs

This commit is contained in:
u-e 2019-03-05 21:50:46 +03:00
parent e919c566aa
commit e795d70336
5 changed files with 27 additions and 24 deletions

View File

@ -76,7 +76,7 @@ class PostDisplayContainer extends Component {
render() {
const {
currentAccount, isLoggedIn, parentPost, post,
currentAccount, isLoggedIn, isNewPost, parentPost, post,
} = this.props;
return (
@ -87,6 +87,7 @@ class PostDisplayContainer extends Component {
handleOnReplyPress={this._handleOnReplyPress}
handleOnVotersPress={this._handleOnVotersPress}
isLoggedIn={isLoggedIn}
isNewPost={isNewPost}
parentPost={parentPost}
post={post}
/>

View File

@ -40,9 +40,9 @@ class PostDisplayView extends PureComponent {
// Component Life Cycles
componentDidMount() {
const { currentAccount, isLoggedIn } = this.props;
const { currentAccount, isLoggedIn, isNewPost } = this.props;
if (isLoggedIn && currentAccount && currentAccount.name) {
if (isLoggedIn && currentAccount && currentAccount.name && !isNewPost) {
userActivity(currentAccount.name, 10);
}
}

View File

@ -1,29 +1,26 @@
import ePointApi from '../../config/ePoint';
export const userActivity = (username, type, blockNumber = '', transactionNumber = '') => {
const params = { username, type };
export const userActivity = (us, ty, bl = '', tx = '') => new Promise((resolve, reject) => {
const params = { us, ty };
if (blockNumber) {
params.blockNumber = blockNumber;
if (bl) {
params.bl = bl;
}
if (transactionNumber) {
params.transactionNumber = transactionNumber;
if (tx) {
params.tx = tx;
}
try {
return ePointApi
.post('/usr-activity', {
us: username,
ty: type,
bn: blockNumber,
tn: transactionNumber,
})
.then(res => res.data);
} catch (error) {
return null;
}
};
ePointApi
.post('/usr-activity', params)
.then((res) => {
console.log(res);
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});
export const transfer = (sender, receiver, amount) => new Promise((resolve, reject) => {
ePointApi

View File

@ -6,6 +6,7 @@ import { injectIntl } from 'react-intl';
// Services and Actions
import { login } from '../../../providers/steem/auth';
import { lookupAccounts } from '../../../providers/steem/dsteem';
import { userActivity } from '../../../providers/esteem/ePoint';
import {
failedAccount,
addOtherAccount,
@ -55,13 +56,16 @@ class LoginContainer extends PureComponent {
dispatch(openPinCodeModal());
setPinCodeState({ navigateTo: ROUTES.DRAWER.MAIN });
dispatch(loginAction(true));
userActivity(result.name, 20);
}
})
.catch((err) => {
Alert.alert('Error',
Alert.alert(
'Error',
intl.formatMessage({
id: err.message,
}));
}),
);
dispatch(failedAccount(err.message));
this.setState({ isLoading: false });
});

View File

@ -47,6 +47,7 @@ class PostScreen extends PureComponent {
fetchPost={fetchPost}
isFetchComments={isFetchComments}
isLoggedIn={isLoggedIn}
isNewPost={isNewPost}
parentPost={parentPost}
post={post}
/>