From 17b42247715fc3f441ca75ff6c9140fe0c5117fb Mon Sep 17 00:00:00 2001 From: Sam Hadow Date: Wed, 31 Jan 2024 23:52:51 +0100 Subject: [PATCH] typo in app.py + clear input field on submit in web part --- src/app.py | 4 ++-- web/app.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app.py b/src/app.py index 8ef0384..851bd4b 100644 --- a/src/app.py +++ b/src/app.py @@ -28,8 +28,8 @@ def add_item(): itemid = data.get('itemid') attributes = data.get('attributes', '').split(',') if data.get('attributes') else [] - new_item = [(itemid, attributes)] - extr = check_items(new_item) + new_item = [itemid, attributes] + extr = check_item(new_item) if len(extr) > 0: skuid = list(extr.values())[0]["skuid"] diff --git a/web/app.js b/web/app.js index 685326b..4ffacaa 100644 --- a/web/app.js +++ b/web/app.js @@ -296,6 +296,10 @@ async function addItem() { attributes: document.getElementById("addattributes").value }; + // clear input fields + document.getElementById("additemid").value=''; + document.getElementById("addattributes").value=''; + const requestOptions = { method: 'POST', headers: { @@ -312,6 +316,9 @@ async function addItem() { if (response.ok) { console.log(response); + // reload window to display new item + location.reload(); + } else { throw new Error('Error in server response'); }