Fixed file upload and profile picture upload error display to work for serverside errors

Этот коммит содержится в:
hmhealey
2015-10-26 14:15:07 -04:00
родитель b46c01b290
Коммит ff6e91f51d
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@@ -253,8 +253,14 @@ export default class CreatePost extends React.Component {
this.setState({uploadsInProgress: draft.uploadsInProgress, previews: draft.previews}); this.setState({uploadsInProgress: draft.uploadsInProgress, previews: draft.previews});
} }
handleUploadError(err, clientId) { handleUploadError(err, clientId) {
let message = err;
if (message && typeof message !== 'string') {
// err is an AppError from the server
message = err.message;
}
if (clientId === -1) { if (clientId === -1) {
this.setState({serverError: err}); this.setState({serverError: message});
} else { } else {
const draft = PostStore.getDraft(this.state.channelId); const draft = PostStore.getDraft(this.state.channelId);
@@ -265,7 +271,7 @@ export default class CreatePost extends React.Component {
PostStore.storeDraft(this.state.channelId, draft); PostStore.storeDraft(this.state.channelId, draft);
this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: err}); this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: message});
} }
} }
handleTextDrop(text) { handleTextDrop(text) {

Просмотреть файл

@@ -171,7 +171,7 @@ export default class UserSettingsGeneralTab extends React.Component {
}.bind(this), }.bind(this),
function imageUploadFailure(err) { function imageUploadFailure(err) {
var state = this.setupInitialState(this.props); var state = this.setupInitialState(this.props);
state.serverError = err; state.serverError = err.message;
this.setState(state); this.setState(state);
}.bind(this) }.bind(this)
); );