Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
API Toucan
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Damien Armillon
API Toucan
Commits
ab6ba111
Commit
ab6ba111
authored
6 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
Post toucan marche dans le front !
parent
ee4d9b7c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
front/src/FormToucan.js
+19
-3
19 additions, 3 deletions
front/src/FormToucan.js
with
19 additions
and
3 deletions
front/src/FormToucan.js
+
19
−
3
View file @
ab6ba111
...
@@ -2,6 +2,7 @@ import React, {Component} from 'react'
...
@@ -2,6 +2,7 @@ import React, {Component} from 'react'
import
{
Form
,
Message
}
from
'
semantic-ui-react
'
import
{
Form
,
Message
}
from
'
semantic-ui-react
'
import
{
DateInput
}
from
'
semantic-ui-calendar-react
'
import
{
DateInput
}
from
'
semantic-ui-calendar-react
'
import
'
moment/locale/fr
'
import
'
moment/locale/fr
'
import
env
from
'
./.env
'
class
FormToucan
extends
Component
{
class
FormToucan
extends
Component
{
...
@@ -47,12 +48,26 @@ class FormToucan extends Component {
...
@@ -47,12 +48,26 @@ class FormToucan extends Component {
this
.
setState
({[
name
]:
file
})
this
.
setState
({[
name
]:
file
})
}
}
onDateChange
=
(
event
,{
name
,
value
})
=>
{
onDateChange
=
(
event
,{
value
})
=>
{
let
[
day
,
month
,
year
]
=
value
.
split
(
"
-
"
)
this
.
setState
({
date
:
new
Date
(
year
,
month
,
day
)});
}
}
onSubmit
=
()
=>
{
onSubmit
=
()
=>
{
console
.
log
(
this
.
state
)
const
{
date
,
title
,
toucan
,
cover
}
=
this
.
state
;
const
form
=
new
FormData
()
form
.
append
(
"
date
"
,
date
)
form
.
append
(
"
title
"
,
title
)
form
.
append
(
"
toucan
"
,
toucan
)
form
.
append
(
"
cover
"
,
cover
)
fetch
(
`
${
env
.
backURL
}
/toucan/toucans`
,{
method
:
'
POST
'
,
body
:
form
})
.
then
((
msg
)
=>
console
.
log
(
msg
))
.
catch
((
err
)
=>
console
.
log
(
err
))
}
}
render
()
{
render
()
{
...
@@ -97,6 +112,7 @@ class FormToucan extends Component {
...
@@ -97,6 +112,7 @@ class FormToucan extends Component {
label
=
"
Date
"
label
=
"
Date
"
localization
=
"
fr
"
localization
=
"
fr
"
name
=
"
date
"
name
=
"
date
"
onChange
=
{
this
.
onDateChange
}
value
=
{
this
.
state
.
date
}
value
=
{
this
.
state
.
date
}
//required
//required
/
>
/
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment