Open jamesplease opened 9 years ago
This depends on https://github.com/jmeas/backbone.intercept/issues/13
Why is logout a route?
For the same reason there's any other route? It's an action tied to a URI. I think this is a pretty common pattern.
Github and Twitter, for instance, use a form that posts to /logout
to log the user out.
Outlines the reasoning really well.
It's certainly possible to do this without the router, but I prefer going through the router in this situation. There is actually a /logout
route on the server, and, by chance, the same functionality can be achieved on the client. For this reason, there should be a client-side route that describes that functionality, I think.
Further, I much prefer not writing it to history than the alternatives. One alternative is simply not having any client-side route at all. It would just be a button that magically logs you out. I dislike this because it just seems weird. Robots, for instance, would not be able to make any sense of it.
Another option would be actually POSTing to the server's /logout
route, which would be an unnecessary HTTP request.
It breaks the back button since logout just redirects you home.