tempIfElseAlert

This commit is contained in:
Kara Hoagland 2022-11-20 14:36:03 -08:00
parent dd3e0cfefb
commit 302af4bbd5

View File

@ -31,19 +31,23 @@ function initFormHandler() {
reviewObject[`${key}`] = `${value}`; reviewObject[`${key}`] = `${value}`;
} }
} }
reviewObject["tags"] = []; if(reviewObject["rating"] != null){
reviewObject["tags"] = [];
let tags = document.querySelectorAll(".tag"); let tags = document.querySelectorAll(".tag");
for(let i = 0; i < tags.length; i ++) { for(let i = 0; i < tags.length; i ++) {
reviewObject["tags"].push(tags[i].innerHTML); reviewObject["tags"].push(tags[i].innerHTML);
tagContainer.removeChild(tags[i]); tagContainer.removeChild(tags[i]);
}
let nextReviewId = newReviewToStorage(reviewObject);
sessionStorage.setItem("currID", JSON.stringify(nextReviewId));
window.location.assign("./ReviewDetails.html");
} else{
window.alert("NO");
} }
let nextReviewId = newReviewToStorage(reviewObject);
sessionStorage.setItem("currID", JSON.stringify(nextReviewId));
window.location.assign("./ReviewDetails.html");
}); });
let tagAddBtn = document.getElementById("tag-add-btn"); let tagAddBtn = document.getElementById("tag-add-btn");