From fd28b7dd193fdc51b91e83129659327a831e9b74 Mon Sep 17 00:00:00 2001 From: anela Date: Fri, 3 Jun 2022 11:30:08 -0700 Subject: [PATCH] addStory unshifts new Story to stories array --- js/models.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/models.js b/js/models.js index dbf5b06..9332881 100644 --- a/js/models.js +++ b/js/models.js @@ -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; } }