How can I automaticly show the login page when the session expires?
Actually the user gets a general error and has to refresh the page.
Hi
Into the current version of the application we do not have such functionality implemented built-in. I will put this requirement in our back log and we will prioritize it for the next major version of the product. At meantime, you can try using following code as workaround:
app/script/extensions/index.js
// Import your custom modules here: export default angular.module('app.extensions.module', [ // Put your custom modules here: ]).run(['$rootScope', 'providerService', '$state', function($rootScope, providerService, $state) { var lastDigestRun = new Date(); $rootScope.$watch(function detectIdle() { var now = new Date(); if (now - lastDigestRun > 20*1000*60) { providerService.unRegisterProviders() .then(function() { $rootScope.hasAuthProviders = false; $state.go('login'); }) .catch(function() { //Error handling $state.go('default.module.application.home'); }); } lastDigestRun = now; })}]) .name;
Best,
Rado
Hi
Into the current version of the application we do not have such functionality implemented built-in. I will put this requirement in our back log and we will prioritize it for the next major version of the product. At meantime, you can try using following code as workaround:
app/script/extensions/index.js
// Import your custom modules here: export default angular.module('app.extensions.module', [ // Put your custom modules here: ]).run(['$rootScope', 'providerService', '$state', function($rootScope, providerService, $state) { var lastDigestRun = new Date(); $rootScope.$watch(function detectIdle() { var now = new Date(); if (now - lastDigestRun > 20*1000*60) { providerService.unRegisterProviders() .then(function() { $rootScope.hasAuthProviders = false; $state.go('login'); }) .catch(function() { //Error handling $state.go('default.module.application.home'); }); } lastDigestRun = now; })}]) .name;
Best,
Rado
This is absolutly answering the Question. But the problem is, my question was wrong. I have to go to the login page everytime the server is responsing an error 401.
For Invoke operations I know I can search for the return value 401. But then I have to implent it in every request and what is with the filter or the page function from the grid and so on.
Can I also impelment a $watch for every request on the server to check the answer for a returning 401?
Hi
You could specify a default error handler for the dataSource:
kendo.data.DataSource.prototype.options.error = function (e) { if (e.status === 401) { //your logic } };
This can be put in an extension file of the custom module.
Best,
Rado