Commit a42abc45 authored by Damien's avatar Damien
Browse files

Debut de tous les toucans pour tout le monde

parent dd89bd1a
import React from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import './App.css';
import MainPage from './view/mainPage';
import AdminPage from './view/AdminPage/AdminPage';
import AllToucanPage from './view/AllToucanPage/AllToucanPage';
import Login from './view/Login';
import env from './.env'
import env from './.env';
import isLogged from './utils/Oauth';
function App() {
return (
<Router >
<Route exact path='/' render={()=>isLogged() ? <MainPage/> : window.location=`${env.backURL}/oauth/login`}/>
<Route exact path='/' component={AllToucanPage} />
<Route exact path='/admin' render={()=>isLogged() ? <AdminPage/> : window.location=`${env.backURL}/oauth/login`}/>
<Route exact path='/login/:token' component={Login} />
</Router>
);
......
......@@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Segment} from 'semantic-ui-react';
import ToucanTable from './showToucan/ToucanTable';
import FormToucan from './FormToucan';
import LogoutButton from './LogoutButton';
import LogoutButton from '../LogoutButton';
class MainPage extends Component {
......
import React, {Component} from 'react'
import {Form, Message} from 'semantic-ui-react'
import env from '../.env'
import env from '../../.env'
class FormToucan extends Component {
constructor(props) {
......
import React, {Component} from 'react'
import {Modal, Button, Image,Message} from 'semantic-ui-react'
import env from '../../.env'
import env from '../../../.env'
class ModalSupression extends Component {
state = {error:''};
......
import React, {Component} from 'react'
import {Table, Image, Button} from 'semantic-ui-react'
import ModalSuppression from './ModalSuppression'
import env from '../../.env'
import env from '../../../.env'
class ToucanLine extends Component {
constructor(props) {
......
import React, {Component} from 'react'
import {Table} from 'semantic-ui-react'
import ToucanLine from './ToucanLine'
import env from '../../.env'
import env from '../../../.env'
class ToucanTable extends Component{
constructor(){
......
import React, {Component} from 'react'
import {Card} from 'semantic-ui-react'
import ToucanCard from './ToucanCard'
import env from '../../.env'
class AllToucan extends Component {
constructor(){
super();
this.state = {
toucans: [],
}
}
componentDidMount(){
fetch(`${env.backURL}/toucan/toucans`)
.then(result => {
return result.json()
})
.then(toucans => {
this.setState({toucans})
console.log(toucans)
})
.catch(err => console.log(err))
}
render(){
return (
<Card.Group>
{this.state.toucans.map( toucan => {
return <ToucanCard
image={`${env.backURL}/toucan/img/${toucan["_id"]}`}
link={`${env.backURL}/toucan/pdf/${toucan["_id"]}`}
header={toucan.title}
/>
})}
</Card.Group>
)}
}
export default AllToucan
\ No newline at end of file
import React from 'react'
import {Card, Image} from 'semantic-ui-react'
const ToucanCard = ({...props}) => {
return (
<Card
href={props.link}
>
<Image src={props.image} size="small"/>
<Card.Content>
<Card.Header content="HDNZIDJZEP"/>
</Card.Content>
</Card>
)
}
export default ToucanCard
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment