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:
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"))

View File

@ -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")
});
}

View File

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