handle case for #169 where project does not yet have an owner
This commit is contained in:
parent
aaa5e868e2
commit
99152f6e37
1 changed files with 12 additions and 6 deletions
|
@ -13,6 +13,7 @@ class FileUploader extends React.Component {
|
|||
}
|
||||
|
||||
createDropzone() {
|
||||
const userId = this.props.project.owner ? this.props.project.owner.id : this.props.user.id;
|
||||
this.uploader = new Dropzone('div#uploader', {
|
||||
url: s3Bucket,
|
||||
method: 'post',
|
||||
|
@ -30,7 +31,7 @@ class FileUploader extends React.Component {
|
|||
text/plain,text/csv,.obj,video/webm,video/ogg,video/quicktime,video/mp4,
|
||||
.otf,.ttf`,
|
||||
dictDefaultMessage: 'Drop files here to upload or click to use the file browser',
|
||||
accept: this.props.dropzoneAcceptCallback.bind(this, this.props.project.owner.id),
|
||||
accept: this.props.dropzoneAcceptCallback.bind(this, userId),
|
||||
sending: this.props.dropzoneSendingCallback,
|
||||
complete: this.props.dropzoneCompleteCallback
|
||||
// error: (file, errorMessage) => {
|
||||
|
@ -53,24 +54,29 @@ FileUploader.propTypes = {
|
|||
dropzoneCompleteCallback: PropTypes.func.isRequired,
|
||||
project: PropTypes.shape({
|
||||
owner: PropTypes.shape({
|
||||
id: PropTypes.string.isRequired
|
||||
id: PropTypes.string
|
||||
})
|
||||
}),
|
||||
user: PropTypes.shape({
|
||||
id: PropTypes.string
|
||||
})
|
||||
};
|
||||
|
||||
FileUploader.defaultProps = {
|
||||
project: {
|
||||
id: undefined,
|
||||
owner: {
|
||||
owner: undefined
|
||||
},
|
||||
user: {
|
||||
id: undefined
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
files: state.files,
|
||||
project: state.project
|
||||
project: state.project,
|
||||
user: state.user
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue