@@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
22import React from 'react' ;
33import { Helmet } from 'react-helmet' ;
44import { connect } from 'react-redux' ;
5- import { browserHistory } from 'react-router' ;
65import { bindActionCreators } from 'redux' ;
76import * as CollectionsActions from '../../IDE/actions/collections' ;
87
@@ -39,19 +38,7 @@ class CollectionCreate extends React.Component {
3938 handleCreateCollection = ( event ) => {
4039 event . preventDefault ( ) ;
4140
42- this . props . createCollection ( this . state . collection )
43- . then ( ( { id, owner } ) => {
44- const pathname = `/${ owner . username } /collections/${ id } ` ;
45- const location = { pathname, state : { skipSavingPath : true } } ;
46-
47- browserHistory . replace ( location ) ;
48- } )
49- . catch ( ( error ) => {
50- console . error ( 'Error creating collection' , error ) ;
51- this . setState ( {
52- creationError : error ,
53- } ) ;
54- } ) ;
41+ this . props . createCollection ( this . state . collection ) ;
5542 }
5643
5744 render ( ) {
@@ -107,12 +94,7 @@ CollectionCreate.propTypes = {
10794 username : PropTypes . string ,
10895 authenticated : PropTypes . bool . isRequired
10996 } ) . isRequired ,
110- createCollection : PropTypes . func . isRequired ,
111- collection : PropTypes . shape ( { } ) . isRequired , // TODO
112- sorting : PropTypes . shape ( {
113- field : PropTypes . string . isRequired ,
114- direction : PropTypes . string . isRequired
115- } ) . isRequired
97+ createCollection : PropTypes . func . isRequired
11698} ;
11799
118100function mapStateToProps ( state , ownProps ) {
0 commit comments