added timeslots

This commit is contained in:
pepper 2021-01-19 01:24:32 -05:00
parent 2b778223e3
commit 54eb79c738

View File

@ -3,6 +3,8 @@ import React, { Component } from "react";
import { callAPI } from "../actions/API"; import { callAPI } from "../actions/API";
import Cards from "./Pages/Cards"; import Cards from "./Pages/Cards";
import GenericList from "../root/Pages/GenericList"; import GenericList from "../root/Pages/GenericList";
import { UList } from "../root/common/Functionality/UnorderedList";
import { builfArrayFromObject } from "../actions/Error";
// Homepage/Cards, first API call here to pass down to cards // Homepage/Cards, first API call here to pass down to cards
// and the pending migration list, if there's no data, nothing will show // and the pending migration list, if there's no data, nothing will show
@ -17,6 +19,7 @@ export class Home extends Component {
super(props); super(props);
this.state = { this.state = {
migs: [], migs: [],
timeslots: [],
}; };
} }
@ -33,6 +36,18 @@ export class Home extends Component {
error: error, error: error,
}); });
}); });
callAPI
.get("/timeslots")
.then((request) => {
this.setState({
timeslots: request.data,
});
})
.catch((error) => {
this.setState({
error: error,
});
});
} }
render() { render() {
@ -45,13 +60,13 @@ export class Home extends Component {
<Cards migs={this.state.migs} /> <Cards migs={this.state.migs} />
</div> </div>
<div className="col s5"> <div className="col s5">
<p>Migrations tracker</p> <p>Current availability for {Date()}</p>
{/* <Cards migs={this.state.migs} /> */} <UList listItems={builfArrayFromObject(this.state.timeslots)} />
</div> </div>
<div className="divider"></div> <div className="divider"></div>
<div className="section"> <div className="section">
<div className="col s12"> <div className="col s12">
<GenericList APILINK="/pending/"/> <GenericList APILINK="/pending/" />
</div> </div>
</div> </div>
<div className="divider"></div> <div className="divider"></div>
@ -61,4 +76,4 @@ export class Home extends Component {
} }
} }
export default Home; export default Home;