Question

In my Sencha Touch 2 app, I use history navigation and routes.

User is on home page and clicks on "products" which is a restricted route (user needs to be auth first).

From the router, using a before-filter, I see the route which is being accessed (in this case products) is protected, and I redirect the user to login view, using:

that.redirectTo('login');

This works like a charm. But if the user, which is on the login view, hits the back button, Sencha remembered that the user wanted to visit the "products" route.

So Sencha tries to load the products view, reaches the router, the router see's the view is protected and redirects to login.

So in this way, the user will be stuck on the login page, no matter how many times he pushes the back button.

Now, the question:

When redirecting to a route, is there a way not to save that redirect into Sencha Touch's history?

Any idea?

Was it helpful?

Solution

For views that you don't want to have history support, simply add / change the view without using redirectTo.

Straigh to viewport:

Ext.Viewport.add({xtype: 'myview'})

or with navigation view (in a controller):

this.getMyNavView().push({xtype: 'myview'})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top