COmmit test branch
This commit is contained in:
parent
5344a3c2a2
commit
4c8bb9043e
File diff suppressed because one or more lines are too long
|
@ -28,8 +28,14 @@ import DeviceInfo from "react-native-device-info"
|
|||
import AppContainer, { AppNavigator } from "../../App";
|
||||
import Configuration from "../../webservice/persistences/Configuration";
|
||||
import { ScrollView } from 'react-native-gesture-handler';
|
||||
import { store } from "../../redux/store";
|
||||
import axios from "axios";
|
||||
import { logoutActionUrl } from '../../webservice/IlinkConstants';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
export default class OptionsMenu extends Component {
|
||||
class OptionsMenu extends Component {
|
||||
|
||||
static navigatorStyle = {
|
||||
statusBarColor: primaryDarkAdvanced,
|
||||
|
@ -48,6 +54,22 @@ export default class OptionsMenu extends Component {
|
|||
this.setState({ user });
|
||||
}
|
||||
});
|
||||
|
||||
let prevStore = store.getState().authKeyReducer
|
||||
store.subscribe(() => {
|
||||
|
||||
const { authKeyReducer } = store.getState();
|
||||
console.log("authKeyReducer", authKeyReducer);
|
||||
if (prevStore !== authKeyReducer) {
|
||||
if (authKeyReducer.authKey !== null) {
|
||||
|
||||
this.setState({
|
||||
authKey: `${authKeyReducer.authKey.token_type} ${authKeyReducer.authKey.access_token}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,8 +113,6 @@ export default class OptionsMenu extends Component {
|
|||
const items = this.props.navigation.router.childRouters.sta.childRouters;
|
||||
this.setState({ items: items })
|
||||
this.retrieveAndroidInformation()
|
||||
|
||||
|
||||
}
|
||||
updateLangue() {
|
||||
this.setState({ lang: "change" })
|
||||
|
@ -144,6 +164,8 @@ export default class OptionsMenu extends Component {
|
|||
user: null,
|
||||
menu: [],
|
||||
currentId: 0,
|
||||
auth: null,
|
||||
authKey: null
|
||||
}
|
||||
}
|
||||
getGeolocatedUserMenu() {
|
||||
|
@ -526,6 +548,17 @@ export default class OptionsMenu extends Component {
|
|||
{ text: I18n.t('NO'), onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
|
||||
{
|
||||
text: I18n.t('YES'), onPress: () => {
|
||||
axios({
|
||||
url: logoutActionUrl,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': this.state.authKey
|
||||
}
|
||||
}).then((response) => {
|
||||
console.log("DECONNECTE", response);
|
||||
}).catch((error) => {
|
||||
console.warn("DECONNECTE", error);
|
||||
})
|
||||
disconnect().then(() => {
|
||||
IlinkEmitter.emit("userdisconnect");
|
||||
this.props.navigation.navigate("Auth")
|
||||
|
@ -547,6 +580,17 @@ export default class OptionsMenu extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
loading: state.authKeyReducer.loading,
|
||||
authKey: state.authKeyReducer.authKey,
|
||||
error: state.authKeyReducer.error
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => bindActionCreators({
|
||||
getAuthApiKey,
|
||||
}, dispatch);
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(OptionsMenu);
|
||||
const items = StyleSheet.create({
|
||||
content: {
|
||||
width: responsiveWidth(100),
|
||||
|
|
|
@ -4,6 +4,7 @@ import I18n from 'react-native-i18n'
|
|||
import { db } from './persistences/db';
|
||||
import { configActionUrl, isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants"
|
||||
|
||||
|
||||
import Configuration from './persistences/Configuration';
|
||||
var serializeJSON = function (data) {
|
||||
|
||||
|
@ -12,6 +13,9 @@ var serializeJSON = function (data) {
|
|||
}).join('&');
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const getCodeInformation = (code) => {
|
||||
var data = {
|
||||
"tag": 'member', "type": "agen_info_code", "code": code,
|
||||
|
@ -95,7 +99,6 @@ export const valifateAgent = (user, info) => {
|
|||
export const disconnect = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
readBrutUser().then((user) => {
|
||||
|
||||
db.remove({ "_id": user._id }, { multi: true }, (error, numRemoved) => {
|
||||
if (error !== null) {
|
||||
reject(error)
|
||||
|
|
|
@ -6,12 +6,12 @@ export const isDebugMode = false
|
|||
//export const baseUrl = "https://test.ilink-app.com/mobilebackendtest";
|
||||
//export const baseUrl = "http://test.ilink-app.com:8080/mobilebackendtest";
|
||||
//const baseUrl = "https://ilink-app.com/mobilebackendtest2"
|
||||
/*
|
||||
export const baseUrl = "http://test.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://test.ilink-app.com"; */
|
||||
|
||||
export const baseUrl = "https://preprod.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://preprod.ilink-app.com";
|
||||
export const baseUrl = "http://test.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://test.ilink-app.com";
|
||||
|
||||
/* export const baseUrl = "https://preprod.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://preprod.ilink-app.com"; */
|
||||
|
||||
//base url agent test
|
||||
//const baseUrl = "https://ilink-app.com/mobilebackendtest";
|
||||
|
@ -22,6 +22,7 @@ export const networkActionUrl = baseUrl + '/interacted/NetworkAction.php';
|
|||
export const locationActionUrl = baseUrl + '/interacted/LocationAction.php';
|
||||
export const demandeActionUrl = baseUrl + '/interacted/DemandeAction.php';
|
||||
export const configActionUrl = baseUrl + '/interacted/ConfigAction.php';
|
||||
export const logoutActionUrl = testBaseUrl + '/logout';
|
||||
|
||||
export const walletActionUrl = testBaseUrl + '/walletService/wallets';
|
||||
export const walletDetailUrl = testBaseUrl + '/walletService/wallets';
|
||||
|
|
Loading…
Reference in New Issue