From e06d354f333f5f8aa6049ed7afda8b6a607279c7 Mon Sep 17 00:00:00 2001 From: Brice Zele Date: Wed, 3 Jun 2020 12:43:42 +0100 Subject: [PATCH] fix wallet credit treatment --- screens/history-request/HistoryItemDetails.js | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/screens/history-request/HistoryItemDetails.js b/screens/history-request/HistoryItemDetails.js index f29c01c4..63df139d 100644 --- a/screens/history-request/HistoryItemDetails.js +++ b/screens/history-request/HistoryItemDetails.js @@ -197,28 +197,44 @@ class HistoryItemDetails extends Component { if (errorTreatDemand !== null) { if (typeof errorTreatDemand.data !== 'undefined') { - Alert.alert( - I18n.t("ERROR_TREATMENT_DEMAND"), - errorTreatDemand.data.error, - [{ - text: I18n.t('CANCEL_LABEL'), - onPress: () => { }, - style: 'cancel' - }, - { - text: I18n.t("OK"), onPress: () => { - setTimeout(() => { - this.setState({ - displayAmountModifyDialog: true - }); - }, 10); - this.props.creditDemandResetReducer(); - this.props.creditCancelResetReducer(); - } - } - ], - { cancelable: false } - ) + if (errorTreatDemand.status === 426) { + Alert.alert( + I18n.t("ERROR_TREATMENT_DEMAND"), + errorTreatDemand.data.error, + [{ + text: I18n.t('CANCEL_LABEL'), + onPress: () => { }, + style: 'cancel' + }, + { + text: I18n.t("OK"), onPress: () => { + setTimeout(() => { + this.setState({ + displayAmountModifyDialog: true + }); + }, 10); + this.props.creditDemandResetReducer(); + this.props.creditCancelResetReducer(); + } + }], + { cancelable: false } + ); + } + else { + Alert.alert( + I18n.t("ERROR_TREATMENT_DEMAND"), + errorTreatDemand.data.error, + [ + { + text: I18n.t("OK"), onPress: () => { + this.props.creditDemandResetReducer(); + this.props.creditCancelResetReducer(); + } + } + ], + { cancelable: false } + ); + } } }