added generated timeslots

This commit is contained in:
pepper 2021-01-19 19:55:44 -05:00
parent ab4de61b42
commit 2ed7998897

View File

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