Player search

This commit is contained in:
RochesterX
2025-11-17 18:56:31 -05:00
parent 9fd3a76546
commit 310bbc9679
10 changed files with 137 additions and 51 deletions

36
public/info.js Normal file
View File

@@ -0,0 +1,36 @@
import { postData, verifyLogin } from "./client.js";
verifyLogin();
const token = window.localStorage.getItem("token");
const infoForm = document.getElementById("infoForm");
async function fetchPersonalInformation() {
const userData = await postData("https://134.209.36.64:3000/getInfo", {}, token);
console.log(userData);
document.getElementById("usernameField").textContent = userData.Username;
document.getElementById("firstNameField").value = userData.FirstName;
document.getElementById("lastNameField").value = userData.LastName;
document.getElementById("dobField").value = userData.DOB.split("T")[0];
return userData
}
const userData = fetchPersonalInformation();
async function updatePersonalInformation(e) {
console.log(verifyLogin());
e.preventDefault();
const userData = {
firstName: document.getElementById("firstNameField").value,
lastName: document.getElementById("lastNameField").value,
dob: document.getElementById("dobField").value
}
console.log(userData.dob);
const resultObject = await postData("https://134.209.36.64:3000/setInfo", userData, token);
alert(resultObject.message);
}
infoForm.onsubmit = updatePersonalInformation;