Когда пользователь выходит из системы, я хочу удалить все панели, в частности главную запись в приложение после страницы входа, которая является «Main.js» и ее подзонами, такими как «Мои данные», что вы видите ниже, причина в том, что я хочу убедиться, что данные правильного хранилища будут загружены и не будут отображаться старые данные.Sencha Touch: уничтожить панель при выходе из системы
Однако я не знаю, как это сделать и как лучше всего удалять файлы из хранилища/удалять, когда пользователь выходит из системы.
Каковы наилучшие методы обращения с выходом пользователя?
Main.js
Ext.define('app.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
'app.view.TeacherPanel',
'app.view.ParentPanel',
'app.view.AboutPanel',
'app.view.user.Profile'
],
config: {
tabBarPosition: 'bottom',
},
initialize: function() {
console.log('main.initialize');
this.callParent(arguments);
// add data panel
var dataPanel = {
title: 'My Data',
iconCls: 'home',
xtype: eMaliApp.services.App.getActivePanel()
store: 'somestore' // i want this to be reloaded
};
this.add(dataPanel);
// add user panel
var profilePanel = {
title: 'Profile',
iconCls: 'user',
xtype: 'userprofile'
};
this.add(profilePanel);
// add about panel
var aboutPanel = {
title: 'About',
iconCls: 'info',
xtype: 'aboutpanel'
};
this.add(aboutPanel);
// Load general app data
app.services.Store.loadSomeStores();
}
});
Profile.js
onLogoutTap: function(e) {
Ext.Ajax.request({
url: 'session/mobileLogout',
method: 'POST',
useDefaultXhrHeader: false,
withCredentials: true,
callback: function(options, success, response) {
if (!success) {
console.log('Logout failed, redirecting to login page anyway');
}
//Ext.getCmp('main').destroy(); // should be so
Ext.Viewport.removeAll(true, true); // does not remove main
Ext.Viewport.add(Ext.create('app.view.LoginPanel'));
}
});
}