From 2ed79988978d2bcc9f755bf26de5baff87619cb1 Mon Sep 17 00:00:00 2001 From: pepper Date: Tue, 19 Jan 2021 19:55:44 -0500 Subject: [PATCH] added generated timeslots --- src/components/root/Pages/Book.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/components/root/Pages/Book.js b/src/components/root/Pages/Book.js index 0115407..d2e346a 100644 --- a/src/components/root/Pages/Book.js +++ b/src/components/root/Pages/Book.js @@ -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 (
@@ -22,10 +36,13 @@ export default class Book extends Component {
- +
); + }else{ + return(
) + } } }