Wallet detail OK

This commit is contained in:
Brice Zele 2020-05-03 11:21:29 +01:00
parent 9ebea52615
commit a06dcff31a
5 changed files with 189 additions and 179 deletions

File diff suppressed because one or more lines are too long

View File

@ -55,6 +55,7 @@
"WITHDRAWAL_DESCRIPTION": "Make a withdrawal",
"COMMISSION_ACCOUNT_TITLE": "Commission account",
"COMMISSION_TRANSFER_SUCCESS": "Commissions have been transferred to the main account",
"COMMISSION_TRANSFER_ERROR_EMPTY": "The commission balance is empty",
"CONFIRM": "Confirm",
"CONFIRM_TRANSFER_COMMISSION": "Confirm commission transfer",
"CREATION_DATE": "Creation date",
@ -270,7 +271,7 @@
"MAKE_REQUEST": "Make a request",
"DATE_WRONG": "The end date can not be earlier than the start date",
"LOADING_DOTS": "Loading...",
"LOADING_PROGRESS": "Loading",
"LOADING": "Loading",
"EMPTY_LIST_REQUEST": "No request",
"MEMBER_LIST": "List of members",
"FREE_CODE_LIST": "List of available codes",

View File

@ -60,6 +60,7 @@
"CONFIRM_TRANSFER_COMMISSION": "Confirmer le transfert des commissions",
"PRINCIPAL_ACCOUNT_TITLE": "Cpt. principal",
"COMMISSION_TRANSFER_SUCCESS": "Les commissions ont été transférées vers le compte principal",
"COMMISSION_TRANSFER_ERROR_EMPTY": "Le solde commission est vide",
"TRANSACTIONS": "Transactions",
"TRANSACTION_HISTORY": "Historique des transactions",
"WITHDRAWAL_TRANSACTION_HISTORY_DESCRIPTION": "Retrait de",
@ -105,6 +106,7 @@
"EMAIL": "Email",
"COUNTRY": "Pays",
"LOADING_INFO": "Chargement des informations...",
"LOADING": "Chargement",
"LOADING_DESCRIPTION_COUNTRY": "Patientez un instant ! nous récuperons les informations sur votre pays...",
"NETWORK": "Réseau",
"PHONE": "Télephone",

View File

@ -75,7 +75,7 @@ class WalletDetail extends Component {
this.currentLocale = (DeviceInfo.getDeviceLocale().includes("fr") ? "fr" : DeviceInfo.getDeviceLocale());
moment.locale(this.currentLocale);
if (this.props.navigation.state.params.hasOwnProperty('agentId')) {
if (this.isHomeRootView) {
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId);
}
@ -115,7 +115,8 @@ class WalletDetail extends Component {
static navigationOptions = ({ navigation }) => {
return {
//title: this.isHomeRootView ? this.props.navigation.state.params.wallet.network,
//title: I18n.t('WALLET'),
//title: this.isHomeRootView ? I18n.t('WALLET') : ((typeof this.props.navigation.state.params !== 'undefined') && this.props.navigation.state.params.wallet.network),
headerStyle: {
backgroundColor: Color.primaryColor,
paddingTop: 10
@ -233,11 +234,11 @@ class WalletDetail extends Component {
refresh = () => {
const { wallet } = this.props.navigation.state.params;
const { result } = this.props;
console.log("STATE NAVIGATION PARAMS REFRESH", this.props.navigation.state);
if (!this.isHomeRootView) {
const { wallet } = this.props.navigation.state.params;
this.props.getWalletDetailActivated(wallet.agentId);
this.setState({
isTriggerRefresh: true
@ -249,9 +250,10 @@ class WalletDetail extends Component {
}
else {
const wallet = Array.isArray(result.response) && result.response[0];
let agentId = this.props.navigation.state.params.agentId;
this.props.getWalletDetailActivated(agentId);
this.props.getWalletTransactionHistory(this.state.wallet.id);
this.props.getWalletTransactionHistory(wallet.id);
}
}
@ -341,7 +343,7 @@ class WalletDetail extends Component {
if (result !== null) {
if (typeof result.response !== 'undefined') {
const wallet = result.response.filter((item) => item.id === this.state.wallet.id)
const wallet = Array.isArray(result.response) ? result.response[0] : result.response.filter((item) => item.id === this.state.wallet.id)
if (parseInt(wallet.balance_com) === 0) {
Alert.alert(
@ -820,7 +822,7 @@ class WalletDetail extends Component {
this.renderLoader() :
(
this.props.result !== null &&
this.renderDetailWallet(this.props.result.response.filter((item) => item.id === this.state.wallet.id))
this.renderDetailWallet(this.props.result.response)
)
)

View File

@ -31,9 +31,11 @@ export const depositAction = (data) => {
data
})
.then(response => {
console.log('DEPOSIT ACTION', response);
dispatch(fetchDepositSuccess(response));
})
.catch(error => {
console.log('DEPOSIT ACTION', error);
dispatch(fetchDepositError(error.message));
if (error.response)
dispatch(fetchDepositError(error.response));