addStory unshifts new Story to stories array

main
anela 3 years ago
parent 8673a7fdad
commit fd28b7dd19

@ -74,18 +74,18 @@ class StoryList {
*/
async addStory(user, newStory) {
console.log("addStory called");
console.debug("addStory called");
console.log("user.loginToken = ", user.loginToken);
const response = await axios.post(
`${BASE_URL}/stories`,
{ token: user.loginToken, story: newStory }
);
console.log("the response is : ", response);
return new Story(response.data.story);
const story = new Story(response.data.story);
this.stories.unshift(story);
return story;
}
}

Loading…
Cancel
Save