Frontend+API: Namen ändern (POST /user/rename)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,17 @@
|
||||
// Nutzername aus dem Pfad /u/<name>.
|
||||
const username = decodeURIComponent(location.pathname.split("/")[2] || "");
|
||||
|
||||
document.getElementById("rename-form").addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
const res = await api.post("/user/rename", new FormData(e.target));
|
||||
if (res.ok) {
|
||||
location.href = `/u/${encodeURIComponent(res.data.username)}`;
|
||||
} else {
|
||||
document.getElementById("rename-msg").textContent =
|
||||
res.data.error || "Umbenennen fehlgeschlagen.";
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("delete-form").addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
if (!confirm("Konto wirklich unwiderruflich löschen?")) return;
|
||||
|
||||
Reference in New Issue
Block a user