As a newcomer to the world of meteorjs and MongoDB, I am currently navigating through "Getting Started with Meteor.js JavaScript Framework" by Isaac Strack. However, I have hit a roadblock in chapter 6 titled "Granting admin permissions." Despite following the author's code, I seem to encounter an issue where when the admin is logged in and I add an item to the list, the item appears for a split second likely due to local caching and server synchronization. What am I missing or doing wrong in this situation? Below is my code:
Meteor.subscribe('Categories');
Meteor.autosubscribe(function() {
Meteor.subscribe("listdetails",
Session.get('current_list'));
});
Template.categories.lists = function () {
return lists.find({},{sort: {Category: 1}});
};
Session.set('adding_category', false);
// More client-side code goes here...
On the server side:
Meteor.startup(function () {
// Server-side code for publishing data...
});
In both sections:
// Function related to admin user...
lists.allow({
// Allow insert, update, remove operations based on admin/user...
});
HTML Structure:
<head>
<title>LendLib</title>
</head>
<body>
<div style="float:right; margin-right:20px;">
{{loginButtons align="right"}}
</div>
<div id="lendlib">
<div id="categories-container">
{{> categories}}
</div>
<div id="list">
{{> list}}
</div>
</div>
</body>
<template name="categories">
<h2 class="title">
my stuff
</h2>
// HTML template structure...
</template>
<template name="list">
<ul id="lending_list">
// Another part of HTML template...
</ul>
</template>