mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-26 23:05:00 +03:00
implement login fixed bugs
This commit is contained in:
parent
e919c566aa
commit
e795d70336
@ -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}
|
||||
/>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 });
|
||||
});
|
||||
|
@ -47,6 +47,7 @@ class PostScreen extends PureComponent {
|
||||
fetchPost={fetchPost}
|
||||
isFetchComments={isFetchComments}
|
||||
isLoggedIn={isLoggedIn}
|
||||
isNewPost={isNewPost}
|
||||
parentPost={parentPost}
|
||||
post={post}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user