Merge branch 'Borges' of https://github.com/henrydays/ENEI2019 into Borges
# Conflicts: # App/app/actions/index.js # App/app/screens/Home.js # App/package.json
This commit is contained in:
commit
094b5ee5bb
|
@ -2,15 +2,11 @@ export const DATA_AVAILABLE = 'DATA_AVAILABLE';
|
||||||
export const API_LOGIN = 'API_LOGIN';
|
export const API_LOGIN = 'API_LOGIN';
|
||||||
export const CHECK_USER='CHECK_USER';
|
export const CHECK_USER='CHECK_USER';
|
||||||
export const LOGOUT_USER= 'LOGOUT_USER';
|
export const LOGOUT_USER= 'LOGOUT_USER';
|
||||||
<<<<<<< HEAD
|
|
||||||
export const USER_INFO= 'USER_INFO';
|
|
||||||
=======
|
|
||||||
export const USER_INFO= 'USER_INFO'
|
export const USER_INFO= 'USER_INFO'
|
||||||
export const HOLD='HOLD'
|
export const HOLD='HOLD'
|
||||||
export const GET_EVENTS='GET_EVENTS'
|
export const GET_EVENTS='GET_EVENTS'
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
import { AsyncStorage } from 'react-native';
|
import { AsyncStorage } from 'react-native';
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,12 +85,8 @@ const saveToken = async token => {
|
||||||
|
|
||||||
|
|
||||||
const getToken = async () => {
|
const getToken = async () => {
|
||||||
<<<<<<< HEAD
|
|
||||||
var token;
|
|
||||||
=======
|
|
||||||
|
|
||||||
obj={}
|
obj={}
|
||||||
>>>>>>> Enei/master
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,13 +187,6 @@ export function login(user, pass){
|
||||||
|
|
||||||
fetch('http://enei2019.uingress.com/internal/api/token', {
|
fetch('http://enei2019.uingress.com/internal/api/token', {
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
||||||
},
|
|
||||||
body: formBody
|
|
||||||
=======
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -210,7 +195,6 @@ export function login(user, pass){
|
||||||
},
|
},
|
||||||
|
|
||||||
body: formBody
|
body: formBody
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
|
|
||||||
|
@ -224,16 +208,9 @@ export function login(user, pass){
|
||||||
tokenData:'error'
|
tokenData:'error'
|
||||||
});
|
});
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
}).then(res=>res.json()).then(( parsed) => {
|
|
||||||
|
|
||||||
console.log('parsed'+parsed.access_token)
|
|
||||||
|
|
||||||
// deviceStorage.saveItem(parsed.access_token);
|
|
||||||
try {
|
|
||||||
=======
|
|
||||||
}).then(res=>res.json()).then(parsed=>{
|
}).then(res=>res.json()).then(parsed=>{
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
var obj={
|
var obj={
|
||||||
access_token:parsed.access_token,
|
access_token:parsed.access_token,
|
||||||
|
@ -303,15 +280,6 @@ export function getUserInfo(token){
|
||||||
|
|
||||||
return (dispatch)=>{
|
return (dispatch)=>{
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log('get user info');
|
|
||||||
let token;
|
|
||||||
let obj = {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Authorization':`Bearer ${a}`,
|
|
||||||
=======
|
|
||||||
|
|
||||||
//TODO: verificar validade do token
|
//TODO: verificar validade do token
|
||||||
|
|
||||||
console.log('Chamada "getUserInfo"');
|
console.log('Chamada "getUserInfo"');
|
||||||
|
@ -321,8 +289,8 @@ export function getUserInfo(token){
|
||||||
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization':"Bearer "+token.access_token,
|
|
||||||
>>>>>>> Enei/master
|
'Authorization': `Bearer ${token.access_token}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
<<<<<<< HEAD
|
|
||||||
import {Button, View, Text, TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
|
||||||
=======
|
|
||||||
|
|
||||||
import { Button, View, Text , TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
import { Button, View, Text , TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
import {
|
import {
|
||||||
RkButton,
|
RkButton,
|
||||||
RkTheme
|
RkTheme
|
||||||
} from 'react-native-ui-kitten';
|
} from 'react-native-ui-kitten';
|
||||||
<<<<<<< HEAD
|
|
||||||
import {connect} from 'react-redux';
|
|
||||||
=======
|
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
|
|
||||||
import * as Actions from '../actions'; //Import your actionss
|
import * as Actions from '../actions'; //Import your actionss
|
||||||
|
@ -35,18 +29,11 @@ class Home extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
<<<<<<< HEAD
|
|
||||||
token: false,
|
|
||||||
tokenData: '',
|
|
||||||
loggedIn: false,
|
|
||||||
onHold: true,
|
|
||||||
user: {}
|
|
||||||
=======
|
|
||||||
token:{valid:false},
|
token:{valid:false},
|
||||||
logged:true,
|
logged:true,
|
||||||
onHold:true,
|
onHold:true,
|
||||||
user:{Name:''}
|
user:{Name:''}
|
||||||
>>>>>>> Enei/master
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,19 +44,13 @@ class Home extends Component {
|
||||||
|
|
||||||
this.props.hold();
|
this.props.hold();
|
||||||
//this.props.logoutUser();
|
//this.props.logoutUser();
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
this.props.getUserInfo();
|
|
||||||
|
|
||||||
console.log('logged:' + this.props.loggedIn);
|
|
||||||
=======
|
|
||||||
//console.log(this.props.token);
|
//console.log(this.props.token);
|
||||||
|
|
||||||
this.props.getUserInfo(this.props.token);
|
this.props.getUserInfo(this.props.token);
|
||||||
|
|
||||||
|
|
||||||
//console.log('logged:'+this.props.logged);
|
//console.log('logged:'+this.props.logged);
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
//console.log(th2is.props)
|
//console.log(th2is.props)
|
||||||
|
|
||||||
|
@ -81,33 +62,17 @@ class Home extends Component {
|
||||||
|
|
||||||
//this.props.logoutUser();
|
//this.props.logoutUser();
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
let a={};
|
let a={};
|
||||||
// this.setState({ user: this.props.user });
|
// this.setState({ user: this.props.user });
|
||||||
// console.log(this.props.user)
|
// console.log(this.props.user)
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
//var navigate = this.props.navigation.navigate
|
//var navigate = this.props.navigation.navigate
|
||||||
}
|
}
|
||||||
|
|
||||||
_logout = () => {
|
_logout = () => {
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("asdasd");
|
|
||||||
// this.props.navigation.navigate('scan');
|
|
||||||
this.props.getUserInfo();
|
|
||||||
// this.props.logout();
|
|
||||||
this.props.logoutUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
console.log(this.props.token);
|
|
||||||
const {navigate} = this.props.navigation;
|
|
||||||
if (this.props.token) {
|
|
||||||
=======
|
|
||||||
|
|
||||||
// this.props.navigation.navigate('scan');
|
// this.props.navigation.navigate('scan');
|
||||||
|
|
||||||
|
@ -142,35 +107,22 @@ class Home extends Component {
|
||||||
|
|
||||||
|
|
||||||
const { navigate } = this.props.navigation;
|
const { navigate } = this.props.navigation;
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
if(this.props.onHold){
|
if(this.props.onHold){
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<<<<<<< HEAD
|
|
||||||
<View>
|
|
||||||
<Button onPress={this._logout} title="LOGOUT"/>
|
|
||||||
<Text></Text>
|
|
||||||
<Text>Nome: {this.props.user.Email}</Text>
|
|
||||||
<Text>city: {this.props.user.City}</Text>
|
|
||||||
<Text>phone: {this.props.user.Mobile}</Text>
|
|
||||||
=======
|
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Text>lollsss {this.props.onHold}</Text>
|
<Text>lollsss {this.props.onHold}</Text>
|
||||||
<ActivityIndicator size="large" color="#0000ff" />
|
<ActivityIndicator size="large" color="#0000ff" />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>>>>>>> Enei/master
|
|
||||||
|
|
||||||
if(this.props.logged){
|
if(this.props.logged){
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View >
|
<View>
|
||||||
|
|
||||||
<Button onPress={this._logout} title="LOGOUT"/>
|
<Button onPress={this._logout} title="LOGOUT"/>
|
||||||
<Button onPress={this.update} title="update"/>
|
<Button onPress={this.update} title="update"/>
|
||||||
|
@ -179,10 +131,7 @@ class Home extends Component {
|
||||||
|
|
||||||
<Text> city: {this.props.user.City}</Text>
|
<Text> city: {this.props.user.City}</Text>
|
||||||
<Text> phone: {this.props.user.Mobile}</Text>
|
<Text> phone: {this.props.user.Mobile}</Text>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -220,18 +169,10 @@ function mapStateToProps(state, props) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
token: state.apiReducer.token,
|
|
||||||
user: state.apiReducer.user
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
token: state.apiReducer.token,
|
token: state.apiReducer.token,
|
||||||
user: state.apiReducer.user,
|
user: state.apiReducer.user,
|
||||||
logged: state.apiReducer.logged
|
logged: state.apiReducer.logged
|
||||||
|
|
||||||
>>>>>>> Enei/master
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
<<<<<<< HEAD
|
|
||||||
"prop-types": "^15.6.2",
|
"prop-types": "^15.6.2",
|
||||||
=======
|
|
||||||
"material-icons-react": "^1.0.4",
|
"material-icons-react": "^1.0.4",
|
||||||
>>>>>>> Enei/master
|
|
||||||
"react": "16.6.3",
|
"react": "16.6.3",
|
||||||
"react-native": "0.57.8",
|
"react-native": "0.57.8",
|
||||||
"react-native-app-intro-slider": "^1.0.1",
|
"react-native-app-intro-slider": "^1.0.1",
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
"prop-types": "^15.6.2",
|
||||||
|
"material-icons-react": "^1.0.4",
|
||||||
|
"react": "16.6.3",
|
||||||
|
"react-native": "0.57.8",
|
||||||
|
"react-native-app-intro-slider": "^1.0.1",
|
Loading…
Reference in New Issue