Wednesday, 2 September 2020

How to show Toaster after logout

I have to show the toaster once I logout from the application. Here is what I am trying. Here I am calling toaster after my logout method.

_this.logout().then({
  success: function (result, request) {
    Ext.toast({
      html: 'Logged Out',
      width: 270,
      cls: 'smart-window alert-box',
      bodyStyle: 'background:#90EE90;',
    });
  },
  failure: function (result, request) {
    console.log('failure!');
  },
});

I have another approach where I am calling toaster before the logout but it is getting disapper after logout. How I can show toaster after logout whih is re directing on toaster page.

Here is my logout where I am redirecting.

logout: function (options) {
        let deferred = Ext.create("Deft.promise.Deferred");
        Ext.Ajax.request({
            url: '/logout',
            method: 'GET',
            success: function (result, request) {
                var url = '/myUrl/logout';
                var method = 'GET';
                Ext.Ajax.request({
                    url: url,
                    method: method,
                    success: function (result, request) {
                        let extraParam = "someconfig";
                        let external_logout = "/someurl";
                        
                        window.location.href = `${external_logout}${extraParam}`, 'width=1000 height=1000, scrollbars=yes, resizable=yes';
                        
                        deferred.resolve(logout);
                    },
                    failure: function (result, request) {
                        deferred.reject();
                    }
                });
            },
            failure: function (result, request) {
                Ext.MessageBox.alert('Failed', 'Request failed');
                deferred.reject();
            }
        });
        return deferred.promise;
    },


from How to show Toaster after logout

No comments:

Post a Comment