fix js linting

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2022-11-20 15:23:22 -08:00
parent 9c531771f2
commit 12e818e079
2 changed files with 20 additions and 20 deletions

View File

@ -22,20 +22,20 @@ function initFormHandler() {
*/ */
let select = document.getElementById("select"); let select = document.getElementById("select");
select.addEventListener("change", function() { select.addEventListener("change", function() {
const input = document.getElementById('source'); const input = document.getElementById("source");
if (select.value == "file") { if (select.value == "file") {
input.innerHTML = ` input.innerHTML = `
Source: Source:
<input type="file" accept="image/*" id="mealImg" name="mealImg"> <input type="file" accept="image/*" id="mealImg" name="mealImg">
` `;
} }
//TODO: change to photo taking for sprint 3 //TODO: change to photo taking for sprint 3
else { else {
input.innerHTML = ` input.innerHTML = `
Source: Source:
<input type="text" id="mealImg" name="mealImg"> <input type="text" id="mealImg" name="mealImg">
` `;
} }
}); });
@ -51,7 +51,7 @@ function initFormHandler() {
//convert image file into data URL for local storage //convert image file into data URL for local storage
reader.readAsDataURL(document.getElementById("mealImg").files[0]); reader.readAsDataURL(document.getElementById("mealImg").files[0]);
}) });
form.addEventListener("submit", function(e){ form.addEventListener("submit", function(e){
/* /*

View File

@ -62,20 +62,20 @@ function setupUpdate(){
*/ */
let select = document.getElementById("select"); let select = document.getElementById("select");
select.addEventListener("change", function() { select.addEventListener("change", function() {
const input = document.getElementById('source'); const input = document.getElementById("source");
if (select.value == "file") { if (select.value == "file") {
input.innerHTML = ` input.innerHTML = `
Source: Source:
<input type="file" accept="image/*" id="mealImg" name="mealImg"> <input type="file" accept="image/*" id="mealImg" name="mealImg">
` `;
} }
//TODO: change to photo taking for sprint 3 //TODO: change to photo taking for sprint 3
else { else {
input.innerHTML = ` input.innerHTML = `
Source: Source:
<input type="text" id="mealImg" name="mealImg"> <input type="text" id="mealImg" name="mealImg">
` `;
} }
}); });
@ -92,7 +92,7 @@ function setupUpdate(){
//convert image file into data URL for local storage //convert image file into data URL for local storage
reader.readAsDataURL(document.getElementById("mealImg").files[0]); reader.readAsDataURL(document.getElementById("mealImg").files[0]);
}) });
//Take formdata values as newData when submit //Take formdata values as newData when submit