Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Damien Armillon
API Toucan
Commits
a42abc45
Commit
a42abc45
authored
May 15, 2019
by
Damien
Browse files
Debut de tous les toucans pour tout le monde
parent
dd89bd1a
Changes
8
Hide whitespace changes
Inline
Side-by-side
front/src/App.js
View file @
a42abc45
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
>
);
...
...
front/src/view/m
a
inPage.js
→
front/src/view/
AdminPage/Ad
minPage.js
View file @
a42abc45
...
...
@@ -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
{
...
...
front/src/view/FormToucan.js
→
front/src/view/
AdminPage/
FormToucan.js
View file @
a42abc45
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
)
{
...
...
front/src/view/showToucan/ModalSuppression.js
→
front/src/view/
AdminPage/
showToucan/ModalSuppression.js
View file @
a42abc45
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
:
''
};
...
...
front/src/view/showToucan/ToucanLine.js
→
front/src/view/
AdminPage/
showToucan/ToucanLine.js
View file @
a42abc45
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
)
{
...
...
front/src/view/showToucan/ToucanTable.js
→
front/src/view/
AdminPage/
showToucan/ToucanTable.js
View file @
a42abc45
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
(){
...
...
front/src/view/AllToucanPage/AllToucanPage.js
0 → 100644
View file @
a42abc45
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
front/src/view/AllToucanPage/ToucanCard.js
0 → 100644
View file @
a42abc45
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment