Hey, I'm facing an issue where when a user lands on a specific page, I need to run a check to see if there are any entries in a collection that are missing a certain attribute. If so, I want to redirect the user. I've outlined what I think the code should look like, but for some reason, I can't get the subscription to work in the routes.js file.
Here's a snippet from my routes.js:
.state('pendingVisits', {
url: '/pendingVisits',
templateUrl: ()=> {
if (Meteor.isCordova) {
return '/packages/visitry-mobile/client/visits/pending-visits/pending-visits.html';
} else {
return '/packages/visitry-browser/client/visits/pending-visits/pending-visits.html';
}
},
controller: 'pendingVisitsCtrl as pendingVisits',
resolve:{
feedback: function($location){
Meteor.subscribe('visits');
var v = Visits.findOne({feedbackId});
if(v){
$location.url('/visits/'+v._id+'/feedback');
}
}
}
});
I'm essentially aiming to replicate Uber's UI behavior, where if there is no feedback for the last event, the feedback page is displayed. Any assistance would be greatly appreciated. Feel free to ask for more code or details if needed.