mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Making it so that Menu and Lists load from db when refreshed.
This commit is contained in:
parent
3ad8fab67b
commit
2f3f82477a
7 changed files with 47 additions and 19 deletions
|
|
@ -2,10 +2,12 @@ import { MenuItems } from '../../imports/api/menuItems.js';
|
|||
import { Menus } from '../../imports/api/menu.js';
|
||||
import moment from 'moment';
|
||||
import { M } from '../lib/assets/materialize.js';
|
||||
import { UserLast } from '../../imports/api/userLast.js';
|
||||
|
||||
Template.menuItemsForm.onCreated(function() {
|
||||
this.subscribe("myMenus");
|
||||
this.subscribe("allMenuItems", Session.get("menuId"));
|
||||
this.subscribe("userLastView");
|
||||
});
|
||||
|
||||
Template.menuItemsForm.onRendered(function() {
|
||||
|
|
@ -29,10 +31,17 @@ Template.menuItemsForm.helpers({
|
|||
return Session.get("menuItemErr");
|
||||
},
|
||||
menuName: function() {
|
||||
let menuId = Session.get("menuId");
|
||||
let menuId = "";
|
||||
if (Session.get("menuId")) {
|
||||
menuId = Session.get("menuId");
|
||||
} else {
|
||||
menuId = UserLast.findOne({ view: "Menu" }).viewId;
|
||||
}
|
||||
|
||||
let menuInfo = Menus.findOne({ _id: menuId });
|
||||
let menuName = menuInfo.menuName;
|
||||
return menuName;
|
||||
if (menuInfo) {
|
||||
return menuInfo.menuName;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue