update frontend javascript

This commit is contained in:
xfarrow 2024-03-04 09:22:33 +01:00
parent 9a79356778
commit fc3356a7ee
2 changed files with 7 additions and 2 deletions

View File

@ -45,6 +45,7 @@
if(!display_name || !email || !password){
alert('Please fill in all fields');
return;
}
const options = {

View File

@ -79,12 +79,16 @@
}
const data = await response.json();
if(response.ok){
if (response.ok){
populateFields(data.display_name, data.email);
document.body.style.display = 'block'; // Show page
}
else if (response.status == 401){
console.error(data.error);
window.location.href = 'login.html';
}
else{
alert(data.error);
alert(`Unable to load profile. Error: ${data.error}`);
}
}