added generated timeslots
This commit is contained in:
parent
ab4de61b42
commit
2ed7998897
@ -1,5 +1,6 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
|
|
||||||
|
import { callAPI } from "../../actions/API";
|
||||||
import FormPage from "../common/Forms/FormPage";
|
import FormPage from "../common/Forms/FormPage";
|
||||||
|
|
||||||
// Parent page for the Book component,
|
// Parent page for the Book component,
|
||||||
@ -10,9 +11,22 @@ export default class Book extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
migs: [],
|
migs: [],
|
||||||
|
timeslots: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
callAPI
|
||||||
|
.get('/gettimeslots/')
|
||||||
|
.then( (response) => {
|
||||||
|
this.setState({
|
||||||
|
timeslots: response.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
if (this.state.timeslots.length > 0) {
|
||||||
return (
|
return (
|
||||||
<div className="container-fluid">
|
<div className="container-fluid">
|
||||||
<div className="section">
|
<div className="section">
|
||||||
@ -22,10 +36,13 @@ export default class Book extends Component {
|
|||||||
|
|
||||||
<div className="section">
|
<div className="section">
|
||||||
<div className="col s12">
|
<div className="col s12">
|
||||||
<FormPage />
|
<FormPage timeslots={this.state.timeslots} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
}else{
|
||||||
|
return(<div></div>)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user