aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2021-02-10 17:07:04 +0100
committerMarvin Borner2021-02-10 17:07:04 +0100
commitf6d3a48fc056adbef78a7f311305db24ab412779 (patch)
tree540fd66c2ceabbcb8bbe54a30e59d31796252061
parent787682fdab595f098ea16fec351f6d43ad0f8e27 (diff)
msg
-rw-r--r--profile/public/user.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/profile/public/user.js b/profile/public/user.js
index 5bd527c..39e7c43 100644
--- a/profile/public/user.js
+++ b/profile/public/user.js
@@ -190,6 +190,11 @@ function addChar(char) {
inp.maxLength = 255;
btn.addEventListener("click", async (e) => {
+ if (inp.value.length < 3) {
+ alert("Bitte gebe dir etwas mehr Mühe. Der Text sollte schon etwas länger sein.");
+ return;
+ }
+
const char = inp.value;
const body = JSON.stringify({ char });
const resp = await fetch(`api/char/${uid}`, {
@@ -198,8 +203,12 @@ function addChar(char) {
body,
});
const res = await resp.json();
- if (res.success) charMethod = "PUT";
- alert("Okidoki, danke!");
+ if (res.success) {
+ charMethod = "PUT";
+ alert("Okidoki, danke!");
+ } else {
+ alert("Fehler, sorry");
+ }
});
const div = document.createElement("div");
div.style.display = "flex";