Commit c874d5d8 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

benerin reward detail

parent e60f9689
......@@ -88,10 +88,10 @@ class RewardDetail extends React.Component {
reward_id: this.props.route.params.rewardId,
delivery_charge: this.props.grabamount,
}
// MULAI DISINI PEMANGGILAN API DI MULAI, KALAU BERHASIL SET VALUE VOUCHER NYA DAN SPINER DIMATIKAN, KALAU GAGAL CABUT SESSION VOUCHER DAN SPINNER DI MATIKAN
Axios.post(this.props.BASE_URL + 'crm/v2/reward/get_value', params).then(res => {
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
......@@ -100,22 +100,30 @@ class RewardDetail extends React.Component {
this.setState({
spinner: false,
})
this.props.navigation.navigate('Home', { screen: 'MENU' })
}).catch(error => {
try {
let response = error.response.data;
Alert.alert(
'',
response.msg,
[
{ text: "OK", onPress: () => this.setState({spinner: false}) }
],
);
// FUNGSI REDUX UNTUK HAPUS VOUCHER
this.props.removeVoucher()
if (response.code == "REWARD_CANNOT_BE_USED") {
this.setState({
spinner: false,
})
this.props.navigation.navigate('Home', { screen: 'MENU' })
} else {
Alert.alert(
'',
response.msg,
[
{ text: "OK", onPress: () => this.setState({ spinner: false }) }
],
);
// FUNGSI REDUX UNTUK HAPUS VOUCHER
this.props.removeVoucher()
}
} catch (error) {
Alert.alert("", error.toString())
}
......@@ -124,7 +132,7 @@ class RewardDetail extends React.Component {
}
useVoucher() {
this.handleVoucherSelect()
this.handleVoucherSelect()
}
......
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