mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2025-09-10 08:27:20 +00:00
updated crud features to work better
Co-authored-by: look-its-ashton <look-its-ashton@users.noreply.github.com> Co-authored-by: Kara Hoagland <KH-Cl@users.noreply.github.com> Co-authored-by: Gavyn Ezell <ezellgavyn@gmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@ function init() {
|
||||
initFormHandler();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array<Object>} reviews An array of reviews
|
||||
*/
|
||||
@@ -33,14 +34,14 @@ function addReviewsToDocument(reviews) {
|
||||
*/
|
||||
function initFormHandler() {
|
||||
|
||||
/*
|
||||
//btn to create form (could be its own function?)
|
||||
let createBtn = document.getElementById("create");
|
||||
let createBtn = document.getElementById("create-btn");
|
||||
createBtn.addEventListener("click", function(){
|
||||
window.location.assign("./CreatePage.html");
|
||||
});*/
|
||||
|
||||
});
|
||||
|
||||
//accessing form components
|
||||
/*
|
||||
let tagContainer = document.getElementById("tag-container-form");
|
||||
let form = document.querySelector("form");
|
||||
|
||||
@@ -48,7 +49,6 @@ function initFormHandler() {
|
||||
/*
|
||||
* User submits the form for their review.
|
||||
* We create reviewCard and put in storage
|
||||
*/
|
||||
let formData = new FormData(form);
|
||||
let reviewObject = {};
|
||||
for (let [key, value] of formData) {
|
||||
@@ -74,6 +74,9 @@ function initFormHandler() {
|
||||
let mainEl = document.querySelector("main");
|
||||
mainEl.append(newReview);
|
||||
|
||||
// TODO: assign an ID to be used for referencing this object form the activeIDs array and the tag arrays
|
||||
let ID = localStorage.nextID;
|
||||
|
||||
let storedReviews = getReviewsFromStorage();
|
||||
storedReviews.push(reviewObject);
|
||||
saveReviewsToStorage(storedReviews);
|
||||
@@ -115,5 +118,6 @@ function initFormHandler() {
|
||||
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user