Skip to content

Commit 4069483

Browse files
committed
Fe update
1 parent 202793f commit 4069483

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

templates/home/index.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
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";
@@ -57,7 +57,7 @@
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 ...";
@@ -71,9 +71,6 @@
7171
}
7272
}
7373

74-
function isEmpty(obj) {
75-
return Object.keys(obj).length === 0;
76-
}
7774

7875

7976

0 commit comments

Comments
 (0)