File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,14 +254,19 @@ export const useFilesStore = function(...args) {
254254 } ,
255255 async delete ( file , deleteFile ) {
256256 file = this . getFile ( file )
257- if ( file ?. uuid !== undefined ) {
257+ if ( file ?. nodeId ) {
258258 const url = deleteFile
259259 ? '/apps/libresign/api/v1/file/file_id/{fileId}'
260260 : '/apps/libresign/api/v1/sign/file_id/{fileId}'
261261 await axios . delete ( generateOcsUrl ( url , {
262262 fileId : file . nodeId ,
263263 } ) )
264264 . then ( ( ) => {
265+ if ( this . selectedNodeId === file . nodeId ) {
266+ const sidebarStore = useSidebarStore ( )
267+ sidebarStore . hideSidebar ( )
268+ this . selectedNodeId = 0
269+ }
265270 del ( this . files , file . nodeId )
266271 const index = this . ordered . indexOf ( file . nodeId )
267272 if ( index > - 1 ) {
@@ -273,11 +278,9 @@ export const useFilesStore = function(...args) {
273278 } ,
274279 async deleteMultiple ( nodeIds , deleteFile ) {
275280 this . loading = true
276- nodeIds . forEach ( async nodeId => {
281+ for ( const nodeId of nodeIds ) {
277282 await this . delete ( this . files [ nodeId ] , deleteFile )
278- } )
279- const toRemove = nodeIds . filter ( nodeId => ( ! this . files [ nodeId ] ?. uuid ) )
280- del ( this . files , ...toRemove )
283+ }
281284 this . loading = false
282285 } ,
283286 async upload ( { file, name } ) {
You can’t perform that action at this time.
0 commit comments