Logout capability
As the user has the option to log in to the application, the user can also log out from it. Inside the Header
class, we have already declared the logout
button. The only thing pending is to implement the listener inside MainController
.
As the MainController
class was created by Sencha Cmd, we are reusing it. The file already has some code in it. Let's remove any listener created by Sencha. MainController
will look like this:
Ext.define('Packt.view.main.MainController', {
extend: 'Ext.app.ViewController',
requires: [
'Ext.MessageBox'
],
alias: 'controller.main',
//we will insert code here
});
In the Header
class, we declared the logout
button, its reference, and its listener. So we need to implement the onLogout
function, as follows:
onLogout: function(button, e, options){ var me = this; //#1 Ext.Ajax.request({ url: 'php/security/logout.php', //#2 scope: me, //#3 success: 'onLogoutSuccess...