Fix post topics being added to followed topics list

This commit is contained in:
Clayton Wilson 2019-12-06 13:35:28 -05:00
parent 4f2e07756d
commit e7afac9a19

View File

@ -84,23 +84,23 @@ class Writing_Microblogs extends Component {
console.error(err); console.error(err);
}); });
console.log(postData.microBlogTopics); console.log(postData.microBlogTopics);
let topicPromises = []; // let topicPromises = [];
postData.microBlogTopics.forEach(topic => { // postData.microBlogTopics.forEach(topic => {
topicPromises.push(axios // topicPromises.push(axios
.post("/putTopic", { // .post("/putTopic", {
following: topic // following: topic
}) // })
.then(res => { // .then(res => {
console.log(res.data); // console.log(res.data);
}) // })
.catch(err => { // .catch(err => {
console.error(err); // console.error(err);
}) // })
) // )
}); // });
event.preventDefault(); event.preventDefault();
topicPromises.push(postPromise); // topicPromises.push(postPromise);
Promise.all(topicPromises) Promise.all([postPromise])
.then(() => { .then(() => {
this.setState({ this.setState({
value: "", value: "",