saving cookies during ajax requests, this could fix #810

This commit is contained in:
antelle 2018-08-28 23:43:15 +02:00
parent 1d72600e05
commit 62efa587cb
1 changed files with 2 additions and 0 deletions

View File

@ -58,6 +58,7 @@ _.extend(StorageBase.prototype, {
}
const statuses = config.statuses || [200];
xhr.addEventListener('load', () => {
CookieManager.saveCookies();
if (statuses.indexOf(xhr.status) >= 0) {
return config.success && config.success(xhr.response, xhr);
}
@ -80,6 +81,7 @@ _.extend(StorageBase.prototype, {
}
});
xhr.addEventListener('error', () => {
CookieManager.saveCookies();
return config.error && config.error('network error', xhr);
});
xhr.addEventListener('timeout', () => {