Additional accounts storage optimization

This commit is contained in:
RainLoop Team 2014-02-04 19:52:58 +04:00
parent cdd1a8e778
commit 23ddda9194
6 changed files with 93 additions and 53 deletions

View file

@ -40,7 +40,6 @@ SettingsAccounts.prototype.addNewAccount = function ()
};
/**
*
* @param {AccountModel} oAccountToRemove
*/
SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
@ -59,8 +58,24 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
{
this.accounts.remove(fRemoveAccount);
RL.remote().accountDelete(function () {
RL.accountsAndIdentities();
RL.remote().accountDelete(function (sResult, oData) {
if (Enums.StorageResultType.Success === sResult && oData &&
oData.Result && oData.Reload)
{
kn.routeOff();
kn.setHash(RL.link().root(), true);
kn.routeOff();
_.defer(function () {
window.location.reload();
});
}
else
{
RL.accountsAndIdentities();
}
}, oAccountToRemove.email);
}
}