Reputation: 509
How do I delay the loading of the whole application? I want to check whether the user accessing is an authorized user before I load the whole application. Is there any event where I could the before application load state? I am currently using Extjs 7.1
Upvotes: 0
Views: 246
Reputation: 851
in your app.js file use launch function to take action on page load.
Ext.application({
extend: 'application.Application',
name: 'application',
requires: [
],
stores: [
],
defaultToken: 'home',
launch: function () {
var me = this;
// make a request to find out if user is auhtenticated
//in callback set me.setMainView('application.view.main.Main');
}
});
Upvotes: 1
Reputation: 1863
The best solution to this problem is to not load application scripts at all until the user has access. This needs to be done on the backend. If you don’t have such an opportunity, you can check users permission and authorization on launch method and create condition in it
...
launch: function () {
if(user.authorized) {
Ext.create('My.Viewport')
} else {
Ext.create('My.PermissionsDenied')
}
}
...
Upvotes: 1