From f7d22cf36ce3a023b948553e127ed51b25217dd8 Mon Sep 17 00:00:00 2001 From: maaa Date: Sun, 9 Jul 2023 02:16:04 +0200 Subject: [PATCH] fixes --- main | 2 +- static/js/main.js | 17 ++++++----------- templates/main.html | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/main b/main index fca487b..f1eb8f9 100644 --- a/main +++ b/main @@ -382,7 +382,7 @@ def signup(): if usersession: return redirect(url_for("main")) if request.method == "POST": - if not check_username_taken(request.form["username"]) == "error": + if not check_username_taken(str(request.form["username"]).lower()) == "error": flash("Username already taken :3") return redirect(url_for("signup")) diff --git a/static/js/main.js b/static/js/main.js index c7a09c7..62e9a3e 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -22,15 +22,13 @@ for (let i = 0; i < posts.length; i++) { title = String(commentBox.value) id = String(commentId.innerHTML) + commentDiv.classList.add("hidden") + commentBurgerDiv.classList.remove("hidden") - function addPost() { - console.log("fart") - - let para = document.createElement("p"); - const node = document.createTextNode(usernameElement.innerHTML + ": " + title); - para.appendChild(node) - commentBurgerDiv.append(para) - } + let para = document.createElement("p"); + const node = document.createTextNode(usernameElement.innerHTML + ": " + title); + para.appendChild(node) + commentBurgerDiv.append(para) fetch("/api/comment", { method: "POST", @@ -42,8 +40,5 @@ for (let i = 0; i < posts.length; i++) { "Content-Type": "application/json" } }) - .then((response) => addPost()) - - commentDiv.classList.add("hidden") }); } \ No newline at end of file diff --git a/templates/main.html b/templates/main.html index 1d854b5..8bf9951 100644 --- a/templates/main.html +++ b/templates/main.html @@ -51,7 +51,7 @@ {% endfor %} {% else %} - + {% endif %}