|
|
@ -73,7 +73,7 @@ class StoryList {
|
|
|
|
* Returns the new Story instance
|
|
|
|
* Returns the new Story instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
async addStory(user, newStory) {
|
|
|
|
async addStory(/*user, newStory*/) {
|
|
|
|
// UNIMPLEMENTED: complete this function!
|
|
|
|
// UNIMPLEMENTED: complete this function!
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
user = ("theCat");
|
|
|
|
user = ("theCat");
|
|
|
@ -85,12 +85,25 @@ class StoryList {
|
|
|
|
let newStory = await storyList.addStory(currentUser,
|
|
|
|
let newStory = await storyList.addStory(currentUser,
|
|
|
|
{title: "Test", author: "Me", url: "http://meow.com"});
|
|
|
|
{title: "Test", author: "Me", url: "http://meow.com"});
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const response = await axios({
|
|
|
|
let user = { userObj:
|
|
|
|
url: `${BASE_URL}/stories`,
|
|
|
|
{ username: "lilithcat",
|
|
|
|
method: "POST",
|
|
|
|
name: "lilithcat",
|
|
|
|
params: {"token": user.loginToken, "story": }
|
|
|
|
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(
|
|
|
|
|
|
|
|
`${BASE_URL}/stories`,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ params: { token: user.loginToken, story: newStory } }
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log("made it after the axios call");
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|