I’ve been migrating to 3.0.from 2.16. I’m sure I’m not doing something properly, but I cannot get anything to return from the helper to the client. I assume something is wrong with my subscription. I get this error in the browser: Uncaught (in promise) Error: Access to storage is not allowed from this context.
Here’s what I have below.
Router:
FlowRouter.route('/listWheelTorque', {
name: 'ListWheelTorque',
waitOn: function() {
return [Meteor.subscribe('WheelTorque')]
},
loadingTemplate: 'Loading',
action(){
this.render('ListWheelTorque');
}
});
Helper:
Template.ListWheelTorque.helpers({
WheelTorque: async function () {
//Meteor.subscribe('WheelTorque');
const torques = await WheelTorque.find({},{sort:{Make: 1, Model: 1}}).fetchAsync();
alert(torques);
return torques;
}
});
Template:
<tbody>
{{#each WheelTorque}}
<tr>
<td id="id">{{Make}}</td>
<td>{{Model}}</td>
<td>{{Trim}}</td>
<td>{{FirstYear}}</td>
<td>{{LastYear}}</td>
<td>{{Torque}}</td>
<!-- <button id="button"><a href="{{pathFor 'EditStuff'}}">Edit</a></button> -->
<!-- button class="delete" style="padding-bottom: 5px">Delete</button><br/> -->
<button><a href="{{pathFor 'EditWheelTorque' id=this._id}}">Edit</a></button>
</tr>
{{/each}}
</tbody>
Collection:
if (Meteor.isServer) {
Meteor.publish(wheelTorque, function () {
return WheelTorque.find();
});