add unenroll to api home page, minor changes
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
export default `<div>
|
||||
<script>
|
||||
function doLogin(){
|
||||
fetch('/api/auth',{method:'POST',body:JSON.stringify({ name:document.getElementById('name').value.trim(), pin:document.getElementById('pin').value.trim() })})
|
||||
fetch('/api/auth',{method:'POST',body:JSON.stringify({name:document.getElementById('name').value.trim(),pin:document.getElementById('pin').value.trim()})})
|
||||
.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);});}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user