Skip to content
Snippets Groups Projects
Commit c880b3a2 authored by Damien's avatar Damien
Browse files

On refresh quand il faut

parent 2f4e94fe
Branches
No related tags found
No related merge requests found
...@@ -31,7 +31,6 @@ class FormToucan extends Component { ...@@ -31,7 +31,6 @@ class FormToucan extends Component {
} }
onToucanChange = (e) => { onToucanChange = (e) => {
console.log(e.target);
const file = e.target.files[0]; const file = e.target.files[0];
if (file.type === 'application/pdf') { // Si on a bien un pdf if (file.type === 'application/pdf') { // Si on a bien un pdf
...@@ -50,7 +49,7 @@ class FormToucan extends Component { ...@@ -50,7 +49,7 @@ class FormToucan extends Component {
onDateChange = (event,{value}) =>{ onDateChange = (event,{value}) =>{
let [day,month,year] = value.split("-") let [day,month,year] = value.split("-")
this.setState({date: new Date(Date.UTC(year,month-1,day,0,0,0))},()=> console.log(this.state.date.toLocaleDateString())); this.setState({date: new Date(Date.UTC(year,month-1,day,0,0,0))});
} }
onSubmit = () => { onSubmit = () => {
...@@ -66,12 +65,11 @@ class FormToucan extends Component { ...@@ -66,12 +65,11 @@ class FormToucan extends Component {
method: 'POST', method: 'POST',
body: form body: form
}) })
.then((msg)=>console.log(msg)) .then(() => window.location.reload())
.catch((err)=>console.log(err)) .catch((err)=>console.log(err))
} }
render() { render() {
const errorMessage = []; const errorMessage = [];
if (this.state.titleError) { if (this.state.titleError) {
errorMessage.push("Le thème doit faire entre 1 et 60 caractères, les caractères spéciaux ($ € { } [ ] ... ) ne sont pas autorisés") errorMessage.push("Le thème doit faire entre 1 et 60 caractères, les caractères spéciaux ($ € { } [ ] ... ) ne sont pas autorisés")
...@@ -122,7 +120,6 @@ class FormToucan extends Component { ...@@ -122,7 +120,6 @@ class FormToucan extends Component {
{errorMessage.map((err) => {return <li>{err}</li>})} {errorMessage.map((err) => {return <li>{err}</li>})}
</ul> </ul>
} /> } />
<Form.Button disabled={formError} content="C'est parti !" /> <Form.Button disabled={formError} content="C'est parti !" />
</Form> </Form>
) )
......
...@@ -7,7 +7,8 @@ class ModalSupression extends Component { ...@@ -7,7 +7,8 @@ class ModalSupression extends Component {
fetch(`${env.backURL}/toucan/delete/${id}`,{ fetch(`${env.backURL}/toucan/delete/${id}`,{
method: "Post" method: "Post"
}) })
.then(this.props.closeModal()) .then(() => window.location.reload())
.catch(err => console.log(err))
} }
render() { render() {
......
...@@ -14,11 +14,9 @@ class ToucanTable extends Component{ ...@@ -14,11 +14,9 @@ class ToucanTable extends Component{
componentDidMount(){ componentDidMount(){
fetch(`${env.backURL}/toucan/toucans`) fetch(`${env.backURL}/toucan/toucans`)
.then(result => { .then(result => {
console.log(result)
return result.json() return result.json()
}) })
.then(toucans => { .then(toucans => {
console.log(toucans)
this.setState({toucans}) this.setState({toucans})
}) })
.catch(err => console.log(err)) .catch(err => console.log(err))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment