Commit 53e6cbaf authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

merubah url select voucher dari get_detail ke get_value

parent f67b262a
...@@ -42,11 +42,22 @@ class RewardSelect extends React.Component { ...@@ -42,11 +42,22 @@ class RewardSelect extends React.Component {
// } // }
handleSelect(item) { handleSelect(item) {
let params = Object.assign(requestParams,{ let type_trans = ""
if (this.props.type_pickup == true) {
type_trans = 'Pickup'
} else {
type_trans = 'Delivery'
}
let params = {
session_id: this.props.session_id, session_id: this.props.session_id,
reward_id: item.id trans_type: type_trans,
}) order_item: this.props.order_item,
Axios.post(this.props.BASE_URL + 'crm/v2/reward/get_detail', params).then(res => { reward_id: item.id,
delivery_charge: this.props.grabamount,
}
console.log(params)
Axios.post(this.props.BASE_URL + 'crm/v2/reward/get_value', params).then(res => {
// console.log(res.data.reward) // console.log(res.data.reward)
let detail = res.data.reward let detail = res.data.reward
let voucherProps = { let voucherProps = {
...@@ -60,6 +71,9 @@ class RewardSelect extends React.Component { ...@@ -60,6 +71,9 @@ class RewardSelect extends React.Component {
// console.log(this.props.voucher) // console.log(this.props.voucher)
// console.log(this.props.value_voucher) // console.log(this.props.value_voucher)
this.props.navigation.goBack() this.props.navigation.goBack()
}).catch(error => {
let response = error.response.data;
Alert.alert(response.status, response.msg);
}) })
} }
getRewardsList() { getRewardsList() {
...@@ -160,7 +174,29 @@ const mapStateToProps = (state) => { ...@@ -160,7 +174,29 @@ const mapStateToProps = (state) => {
session_id: state.session_id, session_id: state.session_id,
value_voucher: state.value_voucher, value_voucher: state.value_voucher,
voucher: state.voucher, voucher: state.voucher,
BASE_URL: state.BASE_URL BASE_URL: state.BASE_URL,
home_address: state.home_address,
type_pickup: state.type_pickup,
value_voucher: state.value_voucher,
voucher: state.voucher,
session_id: state.session_id,
outlet_id: state.outlet_id,
name_outlet: state.name_outlet,
value_voucher: state.value_voucher,
voucher: state.voucher,
order_quantity: state.order_quantity,
order_total: state.order_total,
order_item: state.order_item,
quantity: state.quantity,
address: state.address,
addressId: state.addressId,
grabtype: state.grabtype,
grabamount: state.grabamount,
grabpickup: state.grabpickup,
grabdropoff: state.grabdropoff,
grabdestination: state.grabdestination,
BASE_URL: state.BASE_URL,
} }
} }
......
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