Rebase, add user feedback

pull/295/head
Will Piers 2016-10-31 10:33:32 -07:00
parent ba7a4b9752
commit 7d339c0bd6
1 changed files with 6 additions and 5 deletions

View File

@ -15,6 +15,7 @@ export const SourceForm = React.createClass({
redirectPath: PropTypes.string,
}).isRequired,
}).isRequired,
addFlashMessage: PropTypes.func.isRequired,
},
getInitialState() {
@ -35,7 +36,7 @@ export const SourceForm = React.createClass({
handleSubmit(e) {
e.preventDefault();
const {router} = this.props;
const {router, params, addFlashMessage} = this.props;
const newSource = Object.assign({}, this.state.source, {
url: this.sourceURL.value,
name: this.sourceName.value,
@ -45,13 +46,13 @@ export const SourceForm = React.createClass({
});
if (this.state.editMode) {
updateSource(newSource).then(() => {
// TODO: use the source.id that comes back from the server, when goller's PR gets merged and the autogenerated code gets banished!
router.push(`/sources/${1}/manage-sources`);
router.push(`/sources/${params.sourceID}/manage-sources`);
addFlashMessage({type: 'success', text: 'The source was successfully updated'});
});
} else {
createSource(newSource).then(() => {
// TODO: use the source.id that comes back from the server, when goller's PR gets merged and the autogenerated code gets banished!
router.push(`/sources/${1}/manage-sources`);
router.push(`/sources/${params.sourceID}/manage-sources`);
addFlashMessage({type: 'success', text: 'The source was successfully created'});
});
}
},