formatting
This commit is contained in:
@@ -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);});}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user