From 6def4e468a89b5b77a42501dec0fddbc8365436d Mon Sep 17 00:00:00 2001 From: u-e Date: Tue, 16 Jul 2019 10:19:41 +0300 Subject: [PATCH] added back action and notificaton --- src/containers/pointsContainer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/containers/pointsContainer.js b/src/containers/pointsContainer.js index c837910f5..0cc743175 100644 --- a/src/containers/pointsContainer.js +++ b/src/containers/pointsContainer.js @@ -3,12 +3,15 @@ import React, { Component } from 'react'; import { Alert } from 'react-native'; import { connect } from 'react-redux'; import get from 'lodash/get'; +import { injectIntl } from 'react-intl'; +import { withNavigation } from 'react-navigation'; // Services and Actions import { getUser, getUserPoints, claim } from '../providers/esteem/ePoint'; import { openPinCodeModal } from '../redux/actions/applicationActions'; import { promote, getAccount } from '../providers/steem/dsteem'; import { getUserDataWithUsername } from '../realm/realm'; +import { toastNotification } from '../redux/actions/uiAction'; // Constant import POINTS from '../constants/options/points'; @@ -167,12 +170,14 @@ class PointsContainer extends Component { }; _promote = async (duration, permlink, author) => { - const { currentAccount, pinCode } = this.props; + const { currentAccount, pinCode, dispatch, intl, navigation } = this.props; this.setState({ isLoading: true }); await promote(author || currentAccount, pinCode, duration, permlink, get(author, 'name')) .then(() => { this.setState({ isLoading: false }); + dispatch(toastNotification(intl.formatMessage({ id: 'alert.successful' }))); + navigation.goBack(); }) .catch(error => { Alert.alert( @@ -230,4 +235,4 @@ const mapStateToProps = state => ({ pinCode: state.account.pin, }); -export default connect(mapStateToProps)(PointsContainer); +export default withNavigation(connect(mapStateToProps)(injectIntl(PointsContainer)));