File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 3737 xhr . onreadystatechange = function ( ) {
3838 if ( xhr . readyState === 4 ) {
3939 var json = JSON . parse ( xhr . responseText ) ;
40- if ( ! isEmpty ( json . response ) ) {
41- document . getElementById ( "short-url" ) . textContent = json . response ;
42- }
43- else {
40+ if ( Object . keys ( json . response ) . length === 0 ) {
4441 document . getElementById ( "short-url" ) . textContent = "There was a problem with your url." ;
42+ return ;
43+
4544 }
45+ document . getElementById ( "short-url" ) . textContent = json . response ;
4646 }
4747 } ;
4848 var contentType = "multipart/form-data; boundary=----WebKitFormBoundary2CKH4r5KWjDsz3Bp" ;
5757 '\n' +
5858 '------WebKitFormBoundary2CKH4r5KWjDsz3Bp--' ) ;
5959
60- // document.getElementById("short-url").textContent = "Loading ...";
60+ document . getElementById ( "short-url" ) . textContent = "Loading ..." ;
6161 }
6262 else {
6363 document . getElementById ( "short-url" ) . textContent = "Long url can not be empty ..." ;
7171 }
7272 }
7373
74- function isEmpty ( obj ) {
75- return Object . keys ( obj ) . length === 0 ;
76- }
7774
7875
7976
You can’t perform that action at this time.
0 commit comments