Updated Lists to pull last viewed list from db

This commit is contained in:
Brian McGonagill 2024-07-30 10:30:10 -05:00
parent be07ec72bd
commit 3ad8fab67b
5 changed files with 97 additions and 6 deletions

View file

@ -1,10 +1,12 @@
import { ListItems } from '../../imports/api/listItems.js';
import { M } from '../lib/assets/materialize.js';
import { UserLast } from '../../imports/api/userLast.js';
Template.listItemsTbl.onCreated(function() {
this.autorun( () => {
this.subscribe("myListItems", Session.get("listId"));
});
this.subscribe("userLastView");
});
Template.listItemsTbl.onRendered(function() {
@ -13,6 +15,14 @@ Template.listItemsTbl.onRendered(function() {
Session.set("showReceivedItems", false);
Session.set("searchVal", "");
if (Session.get("listId")) {
console.log("got List Id in Session var.");
// no action
} else {
let selListId = UserLast.find({ view: "List" }).listId;
Session.set("listId", selListId);
}
});
Template.listItemsTbl.helpers({