async function updateNickname() {
  newNickname = document.getElementById("new-nickname").value.trim();
  if(newNickname == null || newNickname.length == 0) {
    return;
  }
  if(!user.loggedIn) {
    alert("Please login first!");
    return;
  }
  await fetch(new Request("/auth", {method: "POST", body: new URLSearchParams("?nickname=" + newNickname)}));
  document.getElementById("comment-user").innerText = newNickname;
  document.getElementById("user").innerText = newNickname;
  getAndRefreshComments();
}
/* Updates user nickname and refreshes comments section. */
Updates user nickname and refreshes comments section.
Updates user nickname and refreshes comments section .
async function updateNickname() {
  newNickname = document.getElementById("new-nickname").value.trim();
  if(newNickname == null || newNickname.length == 0) {
    return;
  }
  if(!user.loggedIn) {
    alert("Please login first!");
    return;
  }
  await fetch(new Request("/auth", {method: "POST", body: new URLSearchParams("?nickname=" + newNickname)}));
  document.getElementById("comment-user").innerText = newNickname;
  document.getElementById("user").innerText = newNickname;
  getAndRefreshComments();
}
async function updateNickname ( ) { newNickname = document . getElementById ( "new-nickname" ) . value . trim ( ) ; if ( newNickname == null || newNickname . length == 0 ) { return ; } if ( ! user . loggedIn ) { alert ( "Please login first!" ) ; return ; } await fetch ( new Request ( "/auth" , { method : "POST" , body : new URLSearchParams ( "?nickname=" + newNickname ) } ) ) ; document . getElementById ( "comment-user" ) . innerText = newNickname ; document . getElementById ( "user" ) . innerText = newNickname ; getAndRefreshComments ( ) ; }
Updates user nickname and refreshes comments section.
Updates user nickname and refreshes comments section .