mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-18 02:58:48 +00:00
fixed circular progress on home
This commit is contained in:
parent
b85bee7cba
commit
fc9994d42e
@ -42,7 +42,7 @@ class Home extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
axios
|
let userPromise = axios
|
||||||
.get("/user")
|
.get("/user")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -52,17 +52,26 @@ class Home extends Component {
|
|||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
|
|
||||||
axios
|
let postPromise = 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));
|
||||||
|
|
||||||
|
Promise.all([userPromise, postPromise])
|
||||||
|
.then(() => {
|
||||||
|
this.setState({
|
||||||
|
loading: false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
|
||||||
this.props.getLikes();
|
this.props.getLikes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user