This commit is contained in:
maaa 2023-07-09 02:16:04 +02:00
parent ed6ab7cea0
commit f7d22cf36c
3 changed files with 8 additions and 13 deletions

2
main
View File

@ -382,7 +382,7 @@ def signup():
if usersession: if usersession:
return redirect(url_for("main")) return redirect(url_for("main"))
if request.method == "POST": 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") flash("Username already taken :3")
return redirect(url_for("signup")) return redirect(url_for("signup"))

View File

@ -22,15 +22,13 @@ for (let i = 0; i < posts.length; i++) {
title = String(commentBox.value) title = String(commentBox.value)
id = String(commentId.innerHTML) id = String(commentId.innerHTML)
commentDiv.classList.add("hidden")
function addPost() { commentBurgerDiv.classList.remove("hidden")
console.log("fart")
let para = document.createElement("p"); let para = document.createElement("p");
const node = document.createTextNode(usernameElement.innerHTML + ": " + title); const node = document.createTextNode(usernameElement.innerHTML + ": " + title);
para.appendChild(node) para.appendChild(node)
commentBurgerDiv.append(para) commentBurgerDiv.append(para)
}
fetch("/api/comment", { fetch("/api/comment", {
method: "POST", method: "POST",
@ -42,8 +40,5 @@ for (let i = 0; i < posts.length; i++) {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
.then((response) => addPost())
commentDiv.classList.add("hidden")
}); });
} }

View File

@ -51,7 +51,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% else %} {% else %}
<div id="commentBurgerDiv" class="hidden"></div> <div id="commentBurgerDiv" class="hidden commentsdiv"></div>
{% endif %} {% endif %}
<p id="commentId" class="hidden">{{ post.id }}</p> <p id="commentId" class="hidden">{{ post.id }}</p>
<button id="commentButton" class="comment">comment</button> <button id="commentButton" class="comment">comment</button>