mardi 2 décembre 2014

Feature request: routing redirectTo must replace instead of add the current token

In some cases in my routing I want to redirectTo, but I want to replace the token, instead of adding it.

I would like to have an extra argument for this.

In my case I have routed to specific document. While the document is open, I am deleting it.

On the deleteSuccess, my application routes to a clean environment, but when I push the back button it tries to open my deleted document. For this reason the hash to the deleted document must be replaced.


For now, I have overridden the BaseController.redirectTo the following way:



Code:



redirectTo : function(token, force, replace) {
if (!force) {
var currentToken = Ext.util.History.getToken();


if (currentToken === token) {
return false;
}
} else {
Ext.app.route.Router.onStateChange(token);
}


if (replace) {
window.history.replaceState('', '', '#' + token);
} else {
Ext.util.History.add(token);
}


return true;
}

Or is there already another possibility available, that I do not know of?



Feature request: routing redirectTo must replace instead of add the current token

Aucun commentaire:

Enregistrer un commentaire