File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/library-authoring/create-collection Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 55 Form ,
66 ModalDialog ,
77} from '@openedx/paragon' ;
8- import { useParams } from 'react-router-dom' ;
8+ import { useNavigate , useParams } from 'react-router-dom' ;
99import { useIntl } from '@edx/frontend-platform/i18n' ;
1010import { Formik } from 'formik' ;
1111import * as Yup from 'yup' ;
@@ -17,6 +17,7 @@ import { ToastContext } from '../../generic/toast-context';
1717
1818const CreateCollectionModal = ( ) => {
1919 const intl = useIntl ( ) ;
20+ const navigate = useNavigate ( ) ;
2021 const { libraryId } = useParams ( ) ;
2122 if ( ! libraryId ) {
2223 throw new Error ( 'Rendered without libraryId URL parameter' ) ;
@@ -29,8 +30,9 @@ const CreateCollectionModal = () => {
2930 const { showToast } = React . useContext ( ToastContext ) ;
3031
3132 const handleCreate = React . useCallback ( ( values ) => {
32- create . mutateAsync ( values ) . then ( ( ) => {
33+ create . mutateAsync ( values ) . then ( ( data ) => {
3334 closeCreateCollectionModal ( ) ;
35+ navigate ( `/library/${ libraryId } /collections/${ data . key } ` ) ;
3436 showToast ( intl . formatMessage ( messages . createCollectionSuccess ) ) ;
3537 } ) . catch ( ( ) => {
3638 showToast ( intl . formatMessage ( messages . createCollectionError ) ) ;
You can’t perform that action at this time.
0 commit comments