Parse json in loginchange.js

pull/5/head
~erin 2021-07-18 14:28:53 -04:00
parent 5d4caf1804
commit 50ad614814
Signed by: erin
GPG Key ID: DA70E064A8C70F44
1 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ form.addEventListener("submit", async function(event) {
try { try {
const userNotFound = await getUname(); const userNotFound = await getUname();
if (userNotFound !== `User ${uname}`) { if (userNotFound.status == `fail`) {
document.querySelector("#incorrect").innerHTML = `user ${uname} was not found` document.querySelector("#incorrect").innerHTML = `user ${uname} was not found`
} else { } else {
loginChange() loginChange()
@ -47,8 +47,8 @@ form.addEventListener("submit", async function(event) {
async function getUname() { async function getUname() {
let response = await fetch(`/api/users/${uname}`); let response = await fetch(`/api/users/${uname}`);
responseText = await response.text(); responseJson = await response.json();
return responseText; return responseJson;
} }
async function loginChange() { async function loginChange() {