import * as React from 'react'; import { View, Text, TouchableOpacity, Image, SafeAreaView } from 'react-native'; import { connect } from "react-redux"; import { saveUserInfo } from "../../redux/actions/AppUserInfoActions"; import NetInfo from "../../components/netstatus"; import Theme from '../../components/theme.style.js'; import Assets from '../../components/assets.manager.js'; import DB from '../../components/storage'; import CustomSafeArea from '../../components/safeArea.component'; class SuccessUpdateMpin extends React.Component { constructor(props) { super(props) } state = { loading: false } componentDidMount() { this.init() } componentWillUnmount() { } init = async () => { NetInfo.netstatus(isConnected => { if(isConnected) { this.getUserInfo() } }) } getUserInfo = async () => { const SESSION = await DB.session() this.props.saveUserInfo({ token: SESSION.token, card_number: SESSION.user.card_number }).then(data => { if(data.status == 1) { DB.updateProfile(data, res => { this.setState({ loading: false }) }, err => { Alert.alert("Information", `\n${err.message}`) this.setState({ loading: false }) }) } }) .catch(error => {}) } backToMpin = () => { this.props.navigation.reset({ index: 0, routes: [{name: 'Mpin'}], }) } render() { return( Reset MPIN Successful! You have successfully reset your MPIN! For your protection, please do not share your MPIN to anyone. this.backToMpin()}> OK ) } } const mapStateToProps = (state) => { return { userinfo: state.appUserInfoReducer.userinfo, app_theme: state.appThemeReducer.theme } } const mapDispatchToProps = { saveUserInfo } export default connect(mapStateToProps, mapDispatchToProps)(SuccessUpdateMpin)