-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loginRequired without Fast Render #80
Comments
Not to divert this issue but I found it was better to do this in a global tracker outside of the router. Tracker.autorun(function () {
if ( !Meteor.userId() or !Meteor.loggingIn() ) {
FlowRouter.go("/sign-in")
}
}); This way any time the user logs out it goes strait to the sign in page, rather then the next time they change routes. Worth noting that this hooks all routes, not just the ones using the middleware. |
I agree with @Kestanous . |
I'm looking at the comment:
I've noticed that it also works without fast render... |
Same for me. I am using
and then in all the routes Something wrong with that? |
Thats what I'm doing too.... just confused about the comment in the Readme |
@ccorcos @miri-am i dont think it is guaranteed to work because the middleware is non-reactive, and logging in in asynchronous. so if you hit the route, and Meteor.loggingIn completes before the middleware is called, then it should be fine. But i dont think that ordering is guaranteed. you should have experienced the other order by now if i understand correctly. |
@Streemo. Yes. I am doing something like the following to rerun the route when logging in is not completed yet...
|
Hmmm... shouldn't there be a "&& !Meteor.loggingIn()" in if conditional? If I don't see how that code will work without adding the second condition
|
Also I don't think the setTimeout is a strong solution. Outlier cases will
|
I haven't had any problems with this yet... this exchange really ought to happen before the routes are decided though... |
Yeah I feel like login middleware is pretty standard. It's weird that we This moves from having a dedicated login route to having a dedicated login It doesn't make sense to have flowroutes behave based on something which is
|
@Streemo what are u talking about ? use iron router cuz it can wait for data or check the user ? This are the main things the router should be able to do. This is not a template layer in any way. And stop pointing the iron router. There are lots of people, not satisfied with its performance with a hope of having another working router. |
@vlad we can easily implement the blocking functionality in the router If we add it then, we need give more tooling to render loading bars kind of So, what I suggest to do this on the layout level. We will still need more I will do a reference implementation next week where we can see how it My goal for router is to it runs for a change in a router. It register some On 2015 මැයි 4, සඳුදා at පෙ.ව. 6.09 Vlad Shcherbin notifications@github.com
|
Hi Vlad, I appreciate your response. But I believe you misunderstood me. I All of what you mention can be done at the template level, there are tools Imho the main thing a router should be able to do is take a user to a @Streemo https://github.com/Streemo what are u talking about ? use iron This are the main things the router should be able to do. This is not a — |
@arunoda , @Streemo sure, if this can be implemented and easy to write on template layer - it would be nice. Show us the way to simply render the 404 page, login & check the user, do some stuff after the route changed (change the page title, description). I like this router a lot and use it everywhere instead of IR. This are the things I miss. Just show us the way it can be used. Thanks |
Yep. That's the idea. On Mon, May 4, 2015 at 6:48 AM Vlad Shcherbin notifications@github.com
|
@vlad Assuming you're using flow layout, FlowRouter handles 404s, and you Thanks
|
@Streemo I'm speaking about some example of use cases (when e.g u go |
@vlad FR.notFound does this. As for the title and description, I'm not
|
Hmm. Perhaps the router shouldn't run until the login exchange is done... As far as serving a 404 for some missing data, I think this is more of a REST functionality than a web app functionality. The web app just needs to show you a 404 message at the template level. But if you're cURL'ing it, then its more a REST endpoint and should be handled differently... Just so you know, I'm only using this as a client side router. Its quite convenient to use with React. |
@arunoda Hello, are there any plans on more docs of use cases, like this one with the login. What about the middlewares (before/after) feature? It's been a long time from the major last changes were made and I fear, this router might be like an IR, with lots of issues and no support. Any news? |
We need before/after hooks. |
We'll focus on this on #139 |
How would we do this without Fast Render?
The text was updated successfully, but these errors were encountered: