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:
João Borges 2019-02-08 14:58:51 +00:00
commit 094b5ee5bb
4 changed files with 18 additions and 106 deletions

View File

@ -2,15 +2,11 @@ export const DATA_AVAILABLE = 'DATA_AVAILABLE';
export const API_LOGIN = 'API_LOGIN';
export const CHECK_USER='CHECK_USER';
export const LOGOUT_USER= 'LOGOUT_USER';
<<<<<<< HEAD
export const USER_INFO= 'USER_INFO';
=======
export const USER_INFO= 'USER_INFO'
export const HOLD='HOLD'
export const GET_EVENTS='GET_EVENTS'
>>>>>>> Enei/master
import { AsyncStorage } from 'react-native';
@ -89,12 +85,8 @@ const saveToken = async token => {
const getToken = async () => {
<<<<<<< HEAD
var token;
=======
obj={}
>>>>>>> Enei/master
try {
@ -195,13 +187,6 @@ export function login(user, pass){
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',
headers: {
@ -210,7 +195,6 @@ export function login(user, pass){
},
body: formBody
>>>>>>> Enei/master
}).catch(err=>{
@ -224,16 +208,9 @@ export function login(user, pass){
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=>{
>>>>>>> Enei/master
var obj={
access_token:parsed.access_token,
@ -303,15 +280,6 @@ export function getUserInfo(token){
return (dispatch)=>{
<<<<<<< HEAD
console.log('get user info');
let token;
let obj = {
method: 'GET',
headers: {
'Authorization':`Bearer ${a}`,
=======
//TODO: verificar validade do token
console.log('Chamada "getUserInfo"');
@ -321,8 +289,8 @@ export function getUserInfo(token){
method: 'GET',
headers: {
'Authorization':"Bearer "+token.access_token,
>>>>>>> Enei/master
'Authorization': `Bearer ${token.access_token}`,
},
}

View File

@ -1,22 +1,16 @@
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';
>>>>>>> Enei/master
import {
RkButton,
RkTheme
} from 'react-native-ui-kitten';
<<<<<<< HEAD
import {connect} from 'react-redux';
=======
import { connect } from 'react-redux';
>>>>>>> Enei/master
import {bindActionCreators} from 'redux';
import * as Actions from '../actions'; //Import your actionss
@ -35,18 +29,11 @@ class Home extends Component {
super(props);
this.state = {
<<<<<<< HEAD
token: false,
tokenData: '',
loggedIn: false,
onHold: true,
user: {}
=======
token:{valid:false},
logged:true,
onHold:true,
user:{Name:''}
>>>>>>> Enei/master
};
@ -57,19 +44,13 @@ class Home extends Component {
this.props.hold();
//this.props.logoutUser();
<<<<<<< HEAD
this.props.getUserInfo();
console.log('logged:' + this.props.loggedIn);
=======
//console.log(this.props.token);
this.props.getUserInfo(this.props.token);
//console.log('logged:'+this.props.logged);
>>>>>>> Enei/master
//console.log(th2is.props)
@ -81,33 +62,17 @@ class Home extends Component {
//this.props.logoutUser();
<<<<<<< HEAD
=======
let a={};
// this.setState({ user: this.props.user });
// console.log(this.props.user)
//
>>>>>>> Enei/master
//var navigate = this.props.navigation.navigate
}
_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');
@ -142,35 +107,22 @@ class Home extends Component {
const { navigate } = this.props.navigation;
>>>>>>> Enei/master
if(this.props.onHold){
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>
<Text>lollsss {this.props.onHold}</Text>
<ActivityIndicator size="large" color="#0000ff" />
</View>
)
}
>>>>>>> Enei/master
if(this.props.logged){
<<<<<<< HEAD
=======
return (
<View >
<View>
<Button onPress={this._logout} title="LOGOUT"/>
<Button onPress={this.update} title="update"/>
@ -179,10 +131,7 @@ class Home extends Component {
<Text> city: {this.props.user.City}</Text>
<Text> phone: {this.props.user.Mobile}</Text>
>>>>>>> Enei/master
</View>
);
}
@ -220,18 +169,10 @@ function mapStateToProps(state, props) {
return {
<<<<<<< HEAD
token: state.apiReducer.token,
user: state.apiReducer.user
=======
token: state.apiReducer.token,
user: state.apiReducer.user,
logged: state.apiReducer.logged
>>>>>>> Enei/master
}
}

View File

@ -8,11 +8,8 @@
},
"dependencies": {
"axios": "^0.18.0",
<<<<<<< HEAD
"prop-types": "^15.6.2",
=======
"material-icons-react": "^1.0.4",
>>>>>>> Enei/master
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-app-intro-slider": "^1.0.1",

6
App/package.json.rej Normal file
View File

@ -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",