File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/domain/quiz/widgets/quiz-limiter Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ const limitTypeMap = {
4141 [ LimitType . Enrolled ] : 'Please enroll a specific course or challenge first.' ,
4242} ;
4343
44+ // FIXME: use a more precise way to judge instead
45+ function resolveCollectionName ( linkedId ) {
46+ const stringified = linkedId . toString ( ) ;
47+
48+ return stringified . length > 3 && stringified . startsWith ( '2' ) ? 'challenges' : 'courses' ;
49+ }
50+
4451function QuizLimiterWidget ( {
4552 id,
4653 limit = { } ,
@@ -86,7 +93,7 @@ function QuizLimiterWidget({
8693
8794 const handleConfirm = ( ) => {
8895 if ( type === LimitType . Enrolled ) {
89- router . push ( `/learn/courses /${ extra } ` ) ;
96+ router . push ( `/learn/${ resolveCollectionName ( extra ) } /${ extra } ` ) ;
9097 } else if ( type === LimitType . Wallet ) {
9198 bindWallet ( closeDialog ) ;
9299 } else {
You can’t perform that action at this time.
0 commit comments