Using Meteor and FlowRouter for my website, I'm trying to get the following result.
A user receive a mail containing a link to a specific page of our website.
- if the user is already logged on the website, he access the page successfully
- if he's not, he's redirected to the login page. But I would like my user to be redirected to the page he was supposed to access at first after the successful login.
I put my route in PrivateRoute.js. This way I can redirect my user to the login page if he's not logged in. But I don't know how to redirect my user after that.
Is there a way to achieve that using FlowRouter and Meteor? Thanks in advance.
Edit 1: Here is the code I use in PrivateRoute.js:
privateRoutes.route('/test', {
action() {
BlazeLayout.render('MainLayout', {
main: 'test'
});
$(document).ready(function() {
$(this).scrollTop(0);
});
},
name: 'test',
});