formatting

This commit is contained in:
Ean Milligan
2026-04-10 16:03:11 -04:00
parent 86cda618a9
commit 44bbb6e719

View File

@@ -1,10 +1,9 @@
export default `<div> export default `<div>
<script> <script>
function doLogin() { function doLogin(){
fetch('/api/auth', { fetch('/api/auth',{method:'POST',body:JSON.stringify({ name:document.getElementById('name').value.trim(), pin:document.getElementById('pin').value.trim() })})
method:'POST', .catch((e)=>{e.text().then((text)=>{alert(text);});})
body:JSON.stringify({ name:document.getElementById('name').value.trim(), pin:document.getElementById('pin').value.trim() }) .then((r) => {
}).catch((e)=>{e.text().then((text)=>{alert(text);});}).then((r) => {
if(r.status===200){r.json().then((j)=>{localStorage.setItem('name', document.getElementById('name').value.trim());window.location.replace('/api/home/'+j.id);});} if(r.status===200){r.json().then((j)=>{localStorage.setItem('name', document.getElementById('name').value.trim());window.location.replace('/api/home/'+j.id);});}
else{r.text().then((text)=>{alert(text);});} else{r.text().then((text)=>{alert(text);});}
}); });