Add circular progress to home page

This commit is contained in:
Clayton Wilson 2019-12-05 13:35:19 -05:00
parent 739b1cc92a
commit a0d2532c22

View File

@ -35,17 +35,20 @@ const styles = {
class Home extends Component { class Home extends Component {
state = { state = {
likes: [] likes: [],
loading: false
}; };
componentDidMount() { componentDidMount() {
this.setState({loading: true});
axios axios
.get("/getallPosts") .get("/getallPosts")
.then(res => { .then(res => {
// console.log(res.data); // console.log(res.data);
this.setState({ this.setState({
posts: res.data posts: res.data,
loading: false
}); });
}) })
.catch(err => console.log(err)); .catch(err => console.log(err));
@ -139,6 +142,7 @@ class Home extends Component {
return ( return (
authenticated ? ( authenticated ? (
this.state.loading ? (<CircularProgress size={60} style={{marginTop: "300px"}}></CircularProgress>) :
<Grid container> <Grid container>
<Grid item sm={4} xs={8}> <Grid item sm={4} xs={8}>
<Writing_Microblogs /> <Writing_Microblogs />