function * deleteFileSaga (action) {
  try {
    if (action.file.siaUIFolder) {
      yield put(actions.deleteSiaUIFolder(action.file.siapath))
    } else if (action.file.type === 'file') {
      yield siadCall({
        url: '/renter/delete/' + encodeURI(action.file.siapath),
        timeout: 3.6e6, // 60 minute timeout for deleting files
        method: 'POST'
      })
      yield put(actions.getFiles())
    } else if (action.file.type === 'directory') {
      const response = yield siadCall('/renter/files')
      const siafiles = ls(List(response.files), action.file.siapath)
      for (const siafile in siafiles.toArray()) {
        const file = siafiles.get(siafile)
        yield put(actions.deleteFile(file))
      }
    }
  } catch (e) {
    sendError(e)
  }
}
// deleteFileSaga handles DELETE_FILE actions, which can include directories.
deleteFileSaga handles DELETE_FILE actions, which can include directories.
deleteFileSaga handles DELETE_FILE actions which can include directories .
function * deleteFileSaga (action) {
  try {
    if (action.file.siaUIFolder) {
      yield put(actions.deleteSiaUIFolder(action.file.siapath))
    } else if (action.file.type === 'file') {
      yield siadCall({
        url: '/renter/delete/' + encodeURI(action.file.siapath),
        timeout: 3.6e6, 
        method: 'POST'
      })
      yield put(actions.getFiles())
    } else if (action.file.type === 'directory') {
      const response = yield siadCall('/renter/files')
      const siafiles = ls(List(response.files), action.file.siapath)
      for (const siafile in siafiles.toArray()) {
        const file = siafiles.get(siafile)
        yield put(actions.deleteFile(file))
      }
    }
  } catch (e) {
    sendError(e)
  }
}
function * deleteFileSaga ( action ) { try { if ( action . file . siaUIFolder ) { yield put ( actions . deleteSiaUIFolder ( action . file . siapath ) ) } else if ( action . file . type === 'file' ) { yield siadCall ( { url : '/renter/delete/' + encodeURI ( action . file . siapath ) , timeout : 3.6e6 , method : 'POST' } ) yield put ( actions . getFiles ( ) ) } else if ( action . file . type === 'directory' ) { const response = yield siadCall ( '/renter/files' ) const siafiles = ls ( List ( response . files ) , action . file . siapath ) for ( const siafile in siafiles . toArray ( ) ) { const file = siafiles . get ( siafile ) yield put ( actions . deleteFile ( file ) ) } } } catch ( e ) { sendError ( e ) } }
deleteFileSaga handles DELETE_FILE actions, which can include directories.
deleteFileSaga handles DELETE_FILE actions which can include directories .
// 60 minute timeout for deleting files