Last commit before switching mac

This commit is contained in:
Brice Zele 2020-12-07 10:05:44 +01:00
parent 5bfad5f025
commit 9363fc3f1d
5 changed files with 742 additions and 706 deletions

File diff suppressed because one or more lines are too long

View File

@ -249,7 +249,7 @@
"DELETE_GROUP": "Supprimer le groupe",
"CREATOR": "Créateur",
"NOTIFICATIONS": "Notification",
"NO_NOTIFICATION": "Vous n'avez aucune Fnotification",
"NO_NOTIFICATION": "Vous n'avez aucune notification",
"CONFIGURATIONS": "Configuration",
"LOGOUT": "Déconnexion",
"HINT_HOME_SEARCH": " Chercher un lieu, quartier ou ville ",

View File

@ -90,7 +90,7 @@ export class HistoryItem extends React.Component {
};
render() {
console.log("ITEM RENDER", this.props.selfData)
//console.log("ITEM RENDER", this.props.selfData)
return (
<TouchableOpacity onPress={() =>
this.props.navigator.navigate(route.historyItemDetails, {
@ -231,7 +231,7 @@ export class HistoryListItem extends React.Component {
};
_renderItem = ({item}) => {
console.log('ITEM ', item);
//console.log('ITEM ', item);
return (
<HistoryItem
isDemandSend={this.props.isDemandSend}

File diff suppressed because it is too large Load Diff

View File

@ -1,147 +1,149 @@
import React from 'react';
import I18n from 'react-native-i18n'
import {demandeActionUrl, isDebugMode} from "./IlinkConstants"
import {readUser} from './AuthApi'
import React, { Component } from 'react';
var DBEvents = require('react-native-db-models').DBEvents;
var db = require('./persistences/db.js');
import I18n from 'react-native-i18n'
import { isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants"
import { readUser } from './AuthApi'
export const loadDemandeCredit = async () => {
const user = await readUser();
const data = { "tag": "credit_demands", 'id': user.code_membre, "lang": I18n.currentLocale(), test: isDebugMode };
const user = await readUser();
const data = {"tag": "credit_demands", 'id': user.code_membre, "lang": I18n.currentLocale(), test: isDebugMode};
const response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
try {
console.log(response)
let responseJson = await response.json()
console.log(responseJson)
return responseJson;
} catch (e) {
console.log(response.text())
return [];
}
const response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
try {
console.log(response)
let responseJson = await response.json()
console.log(responseJson)
return responseJson;
} catch (e) {
console.log(response.text())
return [];
}
}
export const loadMyDemandeCredit = async () => {
const user = await readUser();
console.log("USER ID", user.agentId);
const data = {
"tag": "credit_demands_of_agent", id: user.agentId
, "lang": I18n.currentLocale(),
test: isDebugMode
const user = await readUser();
console.log("USER ID", user.agentId);
const data = {
"tag": "credit_demands_of_agent", id: user.agentId
, "lang": I18n.currentLocale(),
test: isDebugMode
};
console.log(data)
const response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
try {
console.log(response, "my demande")
let responseJson = await response.json()
console.log(responseJson)
return responseJson;
} catch (e) {
return [];
}
};
console.log(data)
const response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
try {
console.log(response, "my demande")
let responseJson = await response.json()
console.log(responseJson)
return responseJson;
} catch (e) {
return [];
}
}
export const updateCreditDemand = (phone, id) => {
const data = {
"tag": "update_ask_credit", "phone": phone, "id": id,
"lang": I18n.currentLocale(),
test: isDebugMode
}
return fetch(demandeActionUrl, {
"method": "POST",
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
}).then((response) => {
return response.json()
})
.then((responseJson) => {
return responseJson
})
.catch((error) => { console.warn(error) })
const data = {
"tag": "update_ask_credit", "phone": phone, "id": id,
"lang": I18n.currentLocale(),
test: isDebugMode
}
return fetch(demandeActionUrl, {
"method": "POST",
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
}).then((response) => {
return response.json()
})
.then((responseJson) => {
return responseJson
})
.catch((error) => {
console.warn(error)
})
}
export const sendDemande = async (credit) => {
const muser = await readUser()
if (muser !== undefined && muser.code_parrain !== undefined
&& muser.code_membre !== undefined &&
muser.code_membre !== muser.code_parrain) {
let data = {
"tag": "ask_credit",
"phone": muser.phone,
"code": muser.code,
"lang": I18n.currentLocale(),
test: isDebugMode,
"montant": credit
};
const muser = await readUser()
if (muser !== undefined && muser.code_parrain !== undefined
&& muser.code_membre !== undefined &&
muser.code_membre !== muser.code_parrain) {
let data = {
"tag": "ask_credit",
"phone": muser.phone,
"code": muser.code,
"lang": I18n.currentLocale(),
test: isDebugMode,
"montant": credit
};
let response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
let responseTxt = "";
try {
responseTxt = await response.text()
let responseJson = JSON.parse(responseTxt)
return responseJson
} catch (e) {
console.log(response)
console.log("error", responseTxt)
return []
}
let response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
let responseTxt = "";
try {
responseTxt = await response.text()
let responseJson = JSON.parse(responseTxt)
return responseJson
} catch (e) {
console.log(response)
console.log("error", responseTxt)
return []
}
} else
return -1;
} else
return -1;
}
export const sendDemandeSpecificque = async (credit, phone, code_membre) => {
let data = {
"tag": "ask_credit",
"phone": phone,
test: isDebugMode,
code: code_membre,
"montant": credit, "lang": I18n.currentLocale()
};
let data = {
"tag": "ask_credit",
"phone": phone,
test: isDebugMode,
code: code_membre,
"montant": credit, "lang": I18n.currentLocale()
};
let response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
try {
let responseJson = await response.json()
console.log(responseJson)
return responseJson
} catch (e) {
console.log(response)
console.warn(e)
return []
}
let response = await fetch(demandeActionUrl, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
})
try {
let responseJson = await response.json()
console.warn("server response", responseJson);
return responseJson
} catch (e) {
console.warn("server response", response);
console.warn("server response", e);
return []
}
}