← All changes
|
assets/src/js/frontend/course-builder/builder-question/builder-edit-question.js
+4
-12
4.3.7
→
4.4.9
View file →
| @@ -195,14 +195,10 @@ | ||
| 195 | 195 | |
| 196 | 196 | // Reset form state before potential redirect. |
| 197 | 197 | document.dispatchEvent( new CustomEvent( 'lp-course-builder-saved' ) ); |
| 198 | 198 | |
| 199 | - if ( data?.question_id_new ) { | |
| 200 | - const currentUrl = window.location.href; | |
| 201 | - window.location.href = currentUrl.replace( | |
| 202 | - /post-new\/?/, | |
| 203 | - `${ data.question_id_new }/` | |
| 204 | - ); | |
| 199 | + if ( data?.redirect_url ) { | |
| 200 | + window.location.href = data.redirect_url; | |
| 205 | 201 | } |
| 206 | 202 | |
| 207 | 203 | if ( data?.status ) { |
| 208 | 204 | const elStatus = document.querySelector( |
| @@ -1046,14 +1042,10 @@ | ||
| 1046 | 1042 | |
| 1047 | 1043 | // Reset form state before potential redirect. |
| 1048 | 1044 | document.dispatchEvent( new CustomEvent( 'lp-course-builder-saved' ) ); |
| 1049 | 1045 | |
| 1050 | - if ( data?.question_id_new ) { | |
| 1051 | - const currentUrl = window.location.href; | |
| 1052 | - window.location.href = currentUrl.replace( | |
| 1053 | - /post-new\/?/, | |
| 1054 | - `${ data.question_id_new }/` | |
| 1055 | - ); | |
| 1046 | + if ( data?.redirect_url ) { | |
| 1047 | + window.location.href = data.redirect_url; | |
| 1056 | 1048 | } |
| 1057 | 1049 | |
| 1058 | 1050 | if ( data?.status ) { |
| 1059 | 1051 | const elStatus = document.querySelector( |