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 5
5
Form ,
6
6
ModalDialog ,
7
7
} from '@openedx/paragon' ;
8
- import { useParams } from 'react-router-dom' ;
8
+ import { useNavigate , useParams } from 'react-router-dom' ;
9
9
import { useIntl } from '@edx/frontend-platform/i18n' ;
10
10
import { Formik } from 'formik' ;
11
11
import * as Yup from 'yup' ;
@@ -17,6 +17,7 @@ import { ToastContext } from '../../generic/toast-context';
17
17
18
18
const CreateCollectionModal = ( ) => {
19
19
const intl = useIntl ( ) ;
20
+ const navigate = useNavigate ( ) ;
20
21
const { libraryId } = useParams ( ) ;
21
22
if ( ! libraryId ) {
22
23
throw new Error ( 'Rendered without libraryId URL parameter' ) ;
@@ -29,8 +30,9 @@ const CreateCollectionModal = () => {
29
30
const { showToast } = React . useContext ( ToastContext ) ;
30
31
31
32
const handleCreate = React . useCallback ( ( values ) => {
32
- create . mutateAsync ( values ) . then ( ( ) => {
33
+ create . mutateAsync ( values ) . then ( ( data ) => {
33
34
closeCreateCollectionModal ( ) ;
35
+ navigate ( `/library/${ libraryId } /collections/${ data . key } ` ) ;
34
36
showToast ( intl . formatMessage ( messages . createCollectionSuccess ) ) ;
35
37
} ) . catch ( ( ) => {
36
38
showToast ( intl . formatMessage ( messages . createCollectionError ) ) ;
You can’t perform that action at this time.
0 commit comments