fixed adding menu items to the menu.

This commit is contained in:
Brian McGonagill 2025-06-21 13:24:24 -05:00
parent 055d574dcc
commit f12c6bb7c8
2 changed files with 7 additions and 5 deletions

View file

@ -102,7 +102,7 @@ Template.menuItemsForm.events({
} else {
// now add this item to the menu
const addToMenu = async() => {
let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, result, dateSrv);
let result2 = await Meteor.callAsync('addto.Menu', menuId, menuItem, addedItem, dateSrv);
if (!result2) {
console.log(" ERROR adding menuitem to menu: " + error);
} else {
@ -123,15 +123,17 @@ Template.menuItemsForm.events({
if (menuItem == null || menuItem == "") {
Session.set("menuItemErr", true);
} else {
Meteor.call('addto.Menu', menuId, menuItem, menuItemId, dateSrv, isLinked, function(error, nresult) {
if (error) {
const addToMenu = async() => {
let result = await Meteor.callAsync('addto.Menu', menuId, menuItem, menuItemId, dateSrv, isLinked);
if (!result) {
console.log(" ERROR adding menuitem to menu: " + error);
} else {
// console.log("Added item to menu - no problem.");
$("#menuItemInp").val("");
$("#dateServed").val("");
}
});
}
addToMenu();
}
}
},

View file

@ -128,7 +128,7 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to add items to menus. Make sure you are logged in with valid user credentials.');
}
serveDateActual = new Date(dateSrv);
let serveDateActual = new Date(dateSrv);
return Menus.updateAsync({ _id: menuId }, {
$addToSet: {