fix(ui): handle any session expired and trigger transparently a refresh token
this change replace original window.fetch by a wrapper that check any 401 response, is so it will request a refresh token this solve current issue with Favorites & Recent sections that give blank page when token is expired - exclusion of requests to other domain (401 will not be handled here) - security with shares /api/s is not handled - check with CSRF, no risk
This commit is contained in:
@@ -182,8 +182,8 @@ async function loadFiles(options = { insertHistory: true }) {
|
||||
// not required anymore
|
||||
clearTimeout(loadingFiles);
|
||||
|
||||
if (response.status === 401 || response.status === 403) {
|
||||
console.warn('Auth error when loading files, showing empty list');
|
||||
if (response.status === 403) {
|
||||
console.warn('Forbidden when loading files');
|
||||
// FIXME: i18n
|
||||
ui.showError(`<p>Could not load files</p>`);
|
||||
return;
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* This file contains the core functionality, initialization and state management
|
||||
*/
|
||||
|
||||
import { installFetchInterceptor } from '../core/fetchWrapper.js';
|
||||
|
||||
installFetchInterceptor();
|
||||
|
||||
import { formatFileSize, formatQuotaSize } from '../core/formatters.js';
|
||||
import { i18n } from '../core/i18n.js';
|
||||
import { Modal } from '../core/modal.js';
|
||||
|
||||
Reference in New Issue
Block a user