Skip to content
Advertisement

Can not read the slug from url on Flow Router (Meteor)

I’m trying to implement a basic route using Flow Router. But no matter what _id of a collection document I request; I always only get the info about the first document in my collection – ‘Requests’.

So here’s my route definition in the file /lib/routes.js:

JavaScript

Here’s my helper:

JavaScript

Here’s my server publish:

JavaScript

And here’s the template:

JavaScript

What am I doing wrong? Note: In the console, I do see right ‘reqId’ slug due to the console.log command in the route definition. But I do not see the relevant info for the document which it belongs to.

Thanks!

Advertisement

Answer

OK my problem was that I previously had another subscription where I published all the Requests – not just the one with that certain _id. And because I did not create the helper to get only the one with that certain _id; of course server just sent me the very first request.

My solution was only to subscribe to previous subscription and define in the helper to fetch to the request _id:

JavaScript

and the helper:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement