typo in app.py + clear input field on submit in web part
This commit is contained in:
parent
c7a4bc711d
commit
17b4224771
@ -28,8 +28,8 @@ def add_item():
|
|||||||
itemid = data.get('itemid')
|
itemid = data.get('itemid')
|
||||||
attributes = data.get('attributes', '').split(',') if data.get('attributes') else []
|
attributes = data.get('attributes', '').split(',') if data.get('attributes') else []
|
||||||
|
|
||||||
new_item = [(itemid, attributes)]
|
new_item = [itemid, attributes]
|
||||||
extr = check_items(new_item)
|
extr = check_item(new_item)
|
||||||
|
|
||||||
if len(extr) > 0:
|
if len(extr) > 0:
|
||||||
skuid = list(extr.values())[0]["skuid"]
|
skuid = list(extr.values())[0]["skuid"]
|
||||||
|
@ -296,6 +296,10 @@ async function addItem() {
|
|||||||
attributes: document.getElementById("addattributes").value
|
attributes: document.getElementById("addattributes").value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clear input fields
|
||||||
|
document.getElementById("additemid").value='';
|
||||||
|
document.getElementById("addattributes").value='';
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@ -312,6 +316,9 @@ async function addItem() {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
// reload window to display new item
|
||||||
|
location.reload();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Error in server response');
|
throw new Error('Error in server response');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user