mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved boot.js with existing global window.rl
Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
parent
f90dbcc84b
commit
aeb5275648
57 changed files with 284 additions and 380 deletions
|
|
@ -3,7 +3,6 @@ import { pInt, pString } from 'Common/Utils';
|
|||
import { DEFAULT_AJAX_TIMEOUT, TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT } from 'Common/Consts';
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { AbstractBasicPromises } from 'Promises/AbstractBasic';
|
||||
|
||||
|
|
@ -51,7 +50,7 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
// 'Content-Type': 'application/json'
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
};
|
||||
params.XToken = Settings.appSettingsGet('token');
|
||||
params.XToken = rl.settings.app('token');
|
||||
// init.body = JSON.stringify(params);
|
||||
const formData = new FormData(),
|
||||
buildFormData = (formData, data, parentKey) => {
|
||||
|
|
@ -86,8 +85,9 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
return Promise.reject(Notification.AjaxParse);
|
||||
}
|
||||
|
||||
if (data.UpdateToken && GlobalsData.__APP__ && GlobalsData.__APP__.setClientSideToken) {
|
||||
GlobalsData.__APP__.setClientSideToken(data.UpdateToken);
|
||||
if (data.UpdateToken) {
|
||||
rl.hash.set();
|
||||
rl.settings.set('AuthAccountHash', data.UpdateToken);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -136,12 +136,12 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
}
|
||||
|
||||
if (data.ClearAuth || data.Logout || AJAX_ERROR_LIMIT < GlobalsData.iAjaxErrorCount) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.clearClientSideToken) {
|
||||
GlobalsData.__APP__.clearClientSideToken();
|
||||
}
|
||||
if (GlobalsData.__APP__) {
|
||||
rl.hash.clear();
|
||||
|
||||
if (GlobalsData.__APP__ && !data.ClearAuth && GlobalsData.__APP__.loginAndLogoutReload) {
|
||||
GlobalsData.__APP__.loginAndLogoutReload(false, true);
|
||||
if (!data.ClearAuth && GlobalsData.__APP__.loginAndLogoutReload) {
|
||||
GlobalsData.__APP__.loginAndLogoutReload(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue