mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-30 04:03:53 +01:00
bugfix (#5): display bug while uploading a file
This commit is contained in:
parent
089620a6e3
commit
870d4e7ba5
3 changed files with 9 additions and 10 deletions
|
|
@ -122,12 +122,17 @@ export class FilesPage extends React.Component {
|
|||
const updateUI = (filename) => {
|
||||
const files = JSON.parse(JSON.stringify(this.state.files))
|
||||
.map((file) => {
|
||||
// persist file in UI
|
||||
if(file.name === filename){
|
||||
file.virtual = false;
|
||||
delete file.icon;
|
||||
}
|
||||
return file;
|
||||
});
|
||||
// remove from ui if we upload the file in a different directory
|
||||
return path === this.state.path ? file : null;
|
||||
})
|
||||
.filter((file) => {
|
||||
return file === null? false : true;
|
||||
})
|
||||
this.setState({files: files});
|
||||
return Promise.resolve('ok')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ export class ExistingThing extends React.Component {
|
|||
}).catch((err) => {
|
||||
if(err && err.code === 'CANCELLED'){ return }
|
||||
this.setState({icon: 'error', message: err.message});
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@ import { theme, to_rgba } from '../../utilities';
|
|||
@DropTarget('__NATIVE_FILE__', {
|
||||
drop(props, monitor){
|
||||
let files = monitor.getItem().files
|
||||
props.emit('file.upload', props.path, files)
|
||||
.then((ok) => {
|
||||
console.log("DONE", ok)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("ERROR", err)
|
||||
})
|
||||
props.emit('file.upload', props.path, files);
|
||||
}
|
||||
}, (connect, monitor) => ({
|
||||
connectDropFile: connect.dropTarget(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue