@@ -141,14 +141,7 @@ renderbutton.addEventListener("click", (event) => {
141141 const renderurl = "render-api" ;
142142
143143 const selectedformat = document . querySelector ( ".dropdown-item.selected" ) ;
144- let outputFormat ;
145- if ( selectedformat === null ) {
146- console . log ( typeof selectedformat ) ;
147- alert ( "No output format selected. Defaulting to 'classic' format." ) ;
148- outputFormat = "classic" ;
149- } else {
150- outputFormat = selectedformat . id ;
151- }
144+ const outputFormat = selectedformat ?. id ?? 'default' ;
152145 let formData = new FormData ( ) ;
153146 formData . set ( "showComments" , 1 ) ;
154147 formData . set (
@@ -231,13 +224,7 @@ function insertListener() {
231224 const selectedformat = document . querySelector (
232225 ".dropdown-item.selected"
233226 ) ;
234- let outputFormat ;
235- if ( selectedformat === null ) {
236- alert ( "No output format selected. Defaulting to 'classic' format." ) ;
237- outputFormat = "classic" ;
238- } else {
239- outputFormat = selectedformat . id ;
240- }
227+ const outputFormat = selectedformat ?. id ?? 'default' ;
241228 formData . set ( "isInstructor" , 1 ) ;
242229 formData . set ( "includeTags" , 1 ) ;
243230 formData . set ( "showComments" , 1 ) ;
0 commit comments