I have a functionality in my application to display customer listing and then edit page for all customers. I am getting error when user redirect to edit page "Expected template or null, found: undefined"
Below is my code for reference Route.js
Router.route('/user/:userId', function () {
this.render('customeredit');
this.layout('mainNav');
});
HTML
<template name="customeredit">
{{#customerData}}
{{fname}}
{{/customerData}}
</template>
JS
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import '../templates/editUser.html';
import { Customers } from '../../imports/api/customers.js';
Template.customeredit.helpers({
customerData: function() {
var customerId = 'NpWkSWRpkQJKsNecG';
console.log(customerId);
console.log(Customers.findOne({_id: customerId}));
}
});
Also please tell how we can fetch user id from url in my above JS file, as my generated URL is: http://localhost:3000/user/NpWkSWRpkQJKsNecG and i need to fetch "NpWkSWRpkQJKsNecG" in helper.