diff --git a/products/ASC.Files/Client/src/store/FilesActionsStore.js b/products/ASC.Files/Client/src/store/FilesActionsStore.js index 8442dce5b02..969ec1320b6 100644 --- a/products/ASC.Files/Client/src/store/FilesActionsStore.js +++ b/products/ASC.Files/Client/src/store/FilesActionsStore.js @@ -56,31 +56,22 @@ class FilesActionStore { } }; - isEmptyLastPageAfterOperation = (selectionLength) => { - const { filter, files, folders } = this.filesStore; - - return ( - filter.page > 0 && - !filter.hasNext() && - selectionLength === files.length + folders.length - ); - }; - updateCurrentFolder = (selectionLength) => { const { clearSecondaryProgressData, } = this.uploadDataStore.secondaryProgressDataStore; - const { filter, fetchFiles } = this.filesStore; + const { + filter, + fetchFiles, + isEmptyLastPageAfterOperation, + resetFilterPage, + } = this.filesStore; let newFilter; - if ( - selectionLength && - this.isEmptyLastPageAfterOperation(selectionLength) - ) { - newFilter = filter.clone(); - newFilter.page--; + if (selectionLength && isEmptyLastPageAfterOperation(selectionLength)) { + newFilter = resetFilterPage(); } fetchFiles( @@ -336,7 +327,7 @@ class FilesActionStore { label: translations.deleteOperation, alert: false, }); - debugger; + try { await this.deleteItemOperation(isFile, itemId, translations); } catch (err) { diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 75acc4d1b83..58240101e9e 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -269,6 +269,22 @@ class FilesStore { ); }; + isEmptyLastPageAfterOperation = (selectionLength) => { + return ( + this.filter.page > 0 && + !this.filter.hasNext() && + selectionLength === this.files.length + this.folders.length + ); + }; + + resetFilterPage = () => { + let newFilter; + newFilter = this.filter.clone(); + newFilter.page--; + + return newFilter; + }; + fetchFiles = ( folderId, filter, @@ -287,7 +303,7 @@ class FilesStore { const filterStorageItem = localStorage.getItem( `UserFilter=${this.userStore.user.id}` ); - + console.log("FETCH"); if (filterStorageItem && !filter) { const splitFilter = filterStorageItem.split(",");