updated POST request to API for insertStoryIntoFavorites

main
anela 3 years ago
parent f9176cc7df
commit 067c676793

@ -185,19 +185,19 @@ class User {
async insertStoryIntoFavorites(story) { async insertStoryIntoFavorites(story) {
const response = await axios({ const response = await axios({
url: `${BASE_URL}/${username}/favorites/${story.storyId}`, url: `${BASE_URL}/users/${currentUser.username}/favorites/${story.storyId}`,
method: "POST", method: "POST",
data: { token: `${username.loginToken}` } data: { token: `${currentUser.loginToken}` }
}); });
console.log("our response from the api post ...", response); console.log("our response from the api post ...", response);
currentUser.favorites.push(story); // currentUser.favorites.push(story);
console.log("what's inside my favorite list... ", currentUser.favorites); console.log("what's inside my favorite list... ", currentUser.favorites);
} }
/** second mehtod */ /** second method */

Loading…
Cancel
Save