Commit c880b3a2 authored by Damien's avatar Damien
Browse files

On refresh quand il faut

parent 2f4e94fe
......@@ -10,8 +10,8 @@ function App() {
<Segment padded style={{margin:"3%"}}>
<FormToucan />
</Segment>
<Segment textAlign="center" padded style={{margin:"3%"}}>
<ToucanTable/>
<Segment textAlign="center" padded style={{margin:"3%"}} >
<ToucanTable />
</Segment>
</div>
);
......
......@@ -31,7 +31,6 @@ class FormToucan extends Component {
}
onToucanChange = (e) => {
console.log(e.target);
const file = e.target.files[0];
if (file.type === 'application/pdf') { // Si on a bien un pdf
......@@ -50,7 +49,7 @@ class FormToucan extends Component {
onDateChange = (event,{value}) =>{
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 = () => {
......@@ -66,12 +65,11 @@ class FormToucan extends Component {
method: 'POST',
body: form
})
.then((msg)=>console.log(msg))
.then(() => window.location.reload())
.catch((err)=>console.log(err))
}
render() {
const errorMessage = [];
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")
......@@ -122,7 +120,6 @@ class FormToucan extends Component {
{errorMessage.map((err) => {return <li>{err}</li>})}
</ul>
} />
<Form.Button disabled={formError} content="C'est parti !" />
</Form>
)
......
......@@ -7,7 +7,8 @@ class ModalSupression extends Component {
fetch(`${env.backURL}/toucan/delete/${id}`,{
method: "Post"
})
.then(this.props.closeModal())
.then(() => window.location.reload())
.catch(err => console.log(err))
}
render() {
......
......@@ -14,14 +14,12 @@ class ToucanTable extends Component{
componentDidMount(){
fetch(`${env.backURL}/toucan/toucans`)
.then(result => {
console.log(result)
return result.json()
})
.then(toucans => {
console.log(toucans)
this.setState({toucans})
this.setState({toucans})
})
.catch(err => console.log(err))
.catch(err => console.log(err))
}
render() {
......
Markdown is supported
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