|
|
@ -73,36 +73,29 @@ class StoryList {
|
|
|
|
* Returns the new Story instance
|
|
|
|
* Returns the new Story instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
async addStory(/*user, newStory*/) {
|
|
|
|
async addStory(user, newStory) {
|
|
|
|
// UNIMPLEMENTED: complete this function!
|
|
|
|
console.log("addStory called");
|
|
|
|
/*
|
|
|
|
// let user = { userObj:
|
|
|
|
user = ("theCat");
|
|
|
|
// { username: "lilithcat",
|
|
|
|
console.log(user);
|
|
|
|
// name: "lilithcat",
|
|
|
|
let newStory = {title: "house", author: "humannn", url:"www.google.com"};
|
|
|
|
// createdAt: "2022-06-02T19:03:57.323Z",
|
|
|
|
console.log(newStory);
|
|
|
|
// favorites: [],
|
|
|
|
*/
|
|
|
|
// ownStories: [],
|
|
|
|
/*
|
|
|
|
// }, loginToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImxpbGl0aGNhdCIsImlhdCI6MTY1NDE5NjYzN30.cXb98zmezSguUU2NJqBKy7Oi44KAPY970HTF1LWKMNE"};
|
|
|
|
let newStory = await storyList.addStory(currentUser,
|
|
|
|
// let newStory = {
|
|
|
|
{title: "Test", author: "Me", url: "http://meow.com"});
|
|
|
|
// "author": "Matt Lane",
|
|
|
|
*/
|
|
|
|
// "title": "The best story ever",
|
|
|
|
let user = { userObj:
|
|
|
|
// "url": "http://google.com",
|
|
|
|
{ username: "lilithcat",
|
|
|
|
// };
|
|
|
|
name: "lilithcat",
|
|
|
|
console.log("user.loginToken = ", user.loginToken);
|
|
|
|
createdAt: "2022-06-02T19:03:57.323Z",
|
|
|
|
|
|
|
|
favorites: [],
|
|
|
|
|
|
|
|
ownStories: [],
|
|
|
|
|
|
|
|
}, loginToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImxpbGl0aGNhdCIsImlhdCI6MTY1NDE5NjYzN30.cXb98zmezSguUU2NJqBKy7Oi44KAPY970HTF1LWKMNE"};
|
|
|
|
|
|
|
|
let newStory = {
|
|
|
|
|
|
|
|
"author": "Matt Lane",
|
|
|
|
|
|
|
|
"title": "The best story ever",
|
|
|
|
|
|
|
|
"url": "http://google.com",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const response = await axios.post(
|
|
|
|
const response = await axios.post(
|
|
|
|
`${BASE_URL}/stories`,
|
|
|
|
`${BASE_URL}/stories`,
|
|
|
|
|
|
|
|
|
|
|
|
{ params: { token: user.loginToken, story: newStory } }
|
|
|
|
{ params: { token: user.loginToken, story: newStory } }
|
|
|
|
);
|
|
|
|
);
|
|
|
|
console.log("made it after the axios call");
|
|
|
|
console.log("made it after the axios call");
|
|
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|