mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-15 18:08:46 +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() {
|
||||
this.setState({loading: true});
|
||||
axios
|
||||
let userPromise = axios
|
||||
.get("/user")
|
||||
.then(res => {
|
||||
this.setState({
|
||||
@ -52,17 +52,26 @@ class Home extends Component {
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
|
||||
axios
|
||||
let postPromise = axios
|
||||
.get("/getallPosts")
|
||||
.then(res => {
|
||||
// console.log(res.data);
|
||||
this.setState({
|
||||
posts: res.data,
|
||||
loading: false
|
||||
posts: res.data
|
||||
});
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
|
||||
Promise.all([userPromise, postPromise])
|
||||
.then(() => {
|
||||
this.setState({
|
||||
loading: false
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
this.props.getLikes();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user