Commit e884ad26 authored by Afid's avatar Afid

fix error dialog

parent e29f3b08
...@@ -55,15 +55,29 @@ class Renewal extends React.Component { ...@@ -55,15 +55,29 @@ class Renewal extends React.Component {
// console.log(params); // console.log(params);
Axios.post(this.props.BASE_URL + 'crm/v2/card/renewal', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/card/renewal', params).then(res => {
// console.log('ini res ' + JSON.stringify(res.data)) // console.log('ini res ' + JSON.stringify(res.data))
this.setState({spinner: false})
this._getProfile(); this._getProfile();
Toast.show(i18n.t('successRenewal')) Toast.show(i18n.t('successRenewal'))
this.props.navigation.navigate('Home', { screen: 'ACCOUNT' }); this.props.navigation.navigate('Home', { screen: 'ACCOUNT' });
this.setState({ spinner: false })
}).catch(error => { }).catch(error => {
let msg = '';
try {
let response = error.response.data; let response = error.response.data;
// console.log(response.msg) msg = response.msg;
Alert.alert('', response.msg); } catch (err) {
this.setState({ spinner: false }) msg = 'Error Connection';
}
Alert.alert(
'',
msg,
[
{
text: 'OK', onPress: () => this.setState({
spinner: false,
})
}
]
);
}) })
} }
...@@ -102,7 +116,24 @@ class Renewal extends React.Component { ...@@ -102,7 +116,24 @@ class Renewal extends React.Component {
}) })
} }
}).catch(error => { }).catch(error => {
Alert.alert('', response.msg); let msg = '';
try {
let response = error.response.data;
msg = response.msg;
} catch (err) {
msg = 'Error Connection';
}
Alert.alert(
'',
msg,
[
{
text: 'OK', onPress: () => this.setState({
spinner: false,
})
}
]
);
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment