Improved the Switch account system for better feedback to user

This commit is contained in:
djmaze 2021-11-11 21:01:39 +01:00
parent 597ea21b70
commit 739aeaded5
42 changed files with 76 additions and 49 deletions

View file

@ -99,7 +99,7 @@ class LoginUserView extends AbstractViewLogin {
this.submitRequest(true);
data.set('Language', this.bSendLanguage ? this.language() : '');
data.set('SignMe', this.signMe() ? 1 : 0);
Remote.login(
Remote.defaultRequest(
(iError, oData) => {
if (iError) {
this.submitRequest(false);
@ -114,7 +114,7 @@ class LoginUserView extends AbstractViewLogin {
// rl.route.reload();
}
},
data
'Login', data
);
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');

View file

@ -16,7 +16,8 @@ import { doc, Settings, leftPanelDisabled } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme';
//import Remote from 'Remote/User/Fetch';
import Remote from 'Remote/User/Fetch';
import { getNotification } from 'Common/Translator';
export class SystemDropDownUserView extends AbstractViewRight {
constructor() {
@ -46,27 +47,22 @@ export class SystemDropDownUserView extends AbstractViewRight {
}
accountClick(account, event) {
/* TODO
event.preventDefault();
event.stopPropagation();
Remote.switchAccount(
(iError, oData) => {
if (iError) {
console.dir({
iError: iError,
oData: oData
})
} else {
rl.setData(oData.Result);
// rl.route.reload();
}
},
account.email
);
*/
if (account && 0 === event.button) {
AccountUserStore.loading(true);
setTimeout(() => AccountUserStore.loading(false), 1000);
event.preventDefault();
event.stopPropagation();
Remote.defaultRequest(
(iError/*, oData*/) => {
if (iError) {
AccountUserStore.loading(false);
alert(getNotification(iError).replace('%EMAIL%', account.email));
} else {
// This does not work yet
// rl.setData(oData.Result);
location.reload();
}
}, 'AccountSwitch', {Email:account.email}
);
}
return true;
}
@ -97,7 +93,6 @@ export class SystemDropDownUserView extends AbstractViewRight {
doc.cookie = 'rllayout=' + (mobile ? 'mobile' : 'desktop');
ThemeStore.isMobile(mobile);
leftPanelDisabled(mobile);
// location.reload();
}
logoutClick() {