Skip to content
Snippets Groups Projects
Commit 7fc02fb0 authored by Gustavo Hornig's avatar Gustavo Hornig
Browse files

Fix bugs

parent a4573320
No related branches found
No related tags found
1 merge request!2Create category page
......@@ -5,6 +5,7 @@ import MainPage from './Pages/MainPage'
import Login from './Pages/Login'
import Welcome from './Pages/Welcome'
import Map from './Pages/Map'
import Category from './Pages/Category'
class App extends Component {
constructor(props) {
......@@ -23,6 +24,7 @@ class App extends Component {
<Route exact={true} path="/" component={MainPage}/>
<Route exact={true} path="/login" render={()=><Login saveCredentials={this.saveCredentials}/>}/>
<Route exact={true} path="/welcome" render={()=><Welcome credentials={this.state.credentials}/>}/>
<Route exact={true} path="/category" render={()=><Category credentials={this.state.credentials}/>}/>
<Route exact={true} path="/map" component={Map}/>
</div>
</Router>
......
import React, { Component } from 'react';
import './Styles/MainPage.css';
import BarraBrasil from '../Components/BarraBrasil'
import { NavItem, Row, Col, Card } from 'react-materialize'
import AppFooter from '../Components/AppFooter'
import NavigationBar from '../Components/NavigationBar'
import { Redirect } from 'react-router-dom'
import { URL, ADMIN_FEATURES } from '../env'
import axios from 'axios'
import List from '../Components/List'
class Welcome extends Component {
constructor(props) {
console.log("DEBUG : ", props.credentials)
super(props);
this.state={
'credentials': {},
'currentUser': {}
}
}
componentWillMount(){
console.log("DEBUG CREDENTIALS -> : ", this.props)
if(this.props.credentials.id) {
axios.get(`${URL}end_users/${this.props.credentials.userId}?access_token=${this.props.credentials.id}`).then((resp) => {
console.log(resp)
this.setState({'credentials': this.props.credentials, 'currentUser': resp.data.result})
})
}
}
render() {
console.log("DEBUG 1: ", this.props.credentials.id);
console.log("DEBUG 2: ", this.state);
if(this.props.credentials.id){
return (
<div>
<BarraBrasil />
<NavigationBar button={<NavItem id={'login-btn'} href='/login'>Login</NavItem>}/>
<Row>
<Col s={12} m={6} offset={'m3'}>
<Card>
<p>Bem-vindo <b>{this.state.currentUser.name}</b>, o que faremos agora?</p>
<Row>
<List items={ADMIN_FEATURES}/>
</Row>
</Card>
</Col>
</Row>
<AppFooter/>
</div>
);
}
else{
return (
<Redirect to='/login'/>
);
}
}
}
export default Welcome;
\ No newline at end of file
......@@ -2,7 +2,7 @@ export const URL = "http://seppirhomologa.c3sl.ufpr.br/mobileAPI/api/"
export const ADMIN_FEATURES = [
{'value':'Gerar Relatório', 'active': false},
{'value':'Gerenciar Usuários', 'active': false},
{'value':'Gerenciar Categorias', 'active': false},
{'value':'Gerenciar Categorias', 'active': false, 'href':'/category'},
{'value':'Gerenciar Localizações', 'active': false},
{'value':'Visualizar Mapa', 'active': false}
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment