From 08bddfdfd3dc951219f37fe1f7713f42680c8f6f Mon Sep 17 00:00:00 2001 From: anela Date: Fri, 3 Jun 2022 11:30:52 -0700 Subject: [PATCH] start of refactoring getNewStoryAndSubmit --- js/stories.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/js/stories.js b/js/stories.js index a522786..7e66eb1 100644 --- a/js/stories.js +++ b/js/stories.js @@ -87,3 +87,35 @@ async function getNewStoryAndSubmit(evt) { //event listener for add story form submit $addStoryForm.on("submit", getNewStoryAndSubmit); + +// async function getNewStoryAndSubmit(evt) { +// console.debug("getNewStoryAndSubmit", evt); +// // clear page then display form +// evt.preventDefault(); +// hidePageComponents(); +// $addStoryForm.show(); + +// // get values from form +// const title = $("#story-title").val(); +// const author = $("#story-author").val(); +// const url = $("#story-url").val(); + +// // put values in an obj +// const newStory = { +// title: title, +// author: author, +// url: url +// }; + +// // instantiate a Story with obj and display on page +// const resultOfAddStoryCall = await storyList.addStory(currentUser, newStory); +// console.log("resultOfAddStoryCall: ", resultOfAddStoryCall); +// hidePageComponents(); +// await getAndShowStoriesOnStart(); + +// //resets form with empty values +// $addStoryForm.trigger("reset"); +// } + +// //event listener for add story form submit +// $addStoryForm.on("submit", getNewStoryAndSubmit);