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: ...

Get Mastering Ext JS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.