refactor
This commit is contained in:
1 parent
730248f3e8
commit
5886777854
1 file changed
+5
-4
@@ -4,6 +4,7 @@ import { initErrors } from "../../shared/error.js";
|
||||
import * as api from "./api/listAPI.js"
|
||||
import * as ui from "./frontend/listUI.js"
|
||||
import { handleResponse } from "../../shared/helper.js";
|
||||
import { abortEditing } from "../../shared/sharedUI.js";
|
||||
|
||||
const addCategoryForm = document.querySelector(".addCategoryForm");
|
||||
const addItemForm = document.querySelector(".addItemForm");
|
||||
@@ -49,11 +50,11 @@ async function editItem(shoppingItem, id) {
|
||||
});
|
||||
|
||||
formElement.addEventListener("click", (e) => {
|
||||
if (e.target.matches(".editForm__buttonAbort")) ui.abort(formElement, shoppingItem);
|
||||
if (e.target.matches(".editForm__buttonAbort")) abortEditing(formElement, shoppingItem);
|
||||
})
|
||||
|
||||
formElement.addEventListener("keydown", (e) => {
|
||||
if (e.key == "Escape") ui.abort(formElement, shoppingItem);
|
||||
if (e.key == "Escape") abortEditing(formElement, shoppingItem);
|
||||
});
|
||||
|
||||
|
||||
@@ -80,12 +81,12 @@ function editCategory(categoryDiv, id) {
|
||||
});
|
||||
|
||||
formElement.addEventListener("click", (e) => {
|
||||
if (e.target.matches(".editForm__buttonAbort")) ui.abort(formElement, categoryDiv);
|
||||
if (e.target.matches(".editForm__buttonAbort")) abortEditing(formElement, categoryDiv);
|
||||
});
|
||||
|
||||
|
||||
formElement.addEventListener("keydown", (e) => {
|
||||
if (e.key == "Escape") ui.abort(formElement, categoryDiv);
|
||||
if (e.key == "Escape") abortEditing(formElement, categoryDiv);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user