Avoid empty command
This commit is contained in:
parent
d1ebe7fe48
commit
e375be853a
1 changed files with 4 additions and 1 deletions
|
@ -241,8 +241,11 @@ socket.on("glitched command", data => {
|
||||||
|
|
||||||
document.querySelector(".validation").addEventListener("click", ev => {
|
document.querySelector(".validation").addEventListener("click", ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
if (!current.plate && !current.ingredient.length && !current.sauce.length && !current.drink && !current.dessert) {
|
||||||
|
alert("Empty command !");
|
||||||
|
return;
|
||||||
|
}
|
||||||
current["client"] = 1;
|
current["client"] = 1;
|
||||||
|
|
||||||
socket.emit("add command", current);
|
socket.emit("add command", current);
|
||||||
current = {"plate": null, "ingredient": [], "sauce": [], "drink": null, "dessert": null};
|
current = {"plate": null, "ingredient": [], "sauce": [], "drink": null, "dessert": null};
|
||||||
document.querySelectorAll("input[name=plate],input[name=drink],input[name=dessert]").forEach( e => {
|
document.querySelectorAll("input[name=plate],input[name=drink],input[name=dessert]").forEach( e => {
|
||||||
|
|
Reference in a new issue