Stub out all SSR, built login page
This commit is contained in:
19
ssr/buildLogin.ts
Normal file
19
ssr/buildLogin.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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() })
|
||||
}).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);});}
|
||||
else{r.text().then((text)=>{alert(text);});}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<p>Please sign in:</p>
|
||||
<label>Name: <input id="name" type="text" autocomplete="off"/></label>
|
||||
<br/>
|
||||
<label>PIN: <input id="pin" type="password" autocomplete="off"/></label>
|
||||
<br/>
|
||||
<button onclick="doLogin()">Sign In</button>
|
||||
</div>`;
|
||||
Reference in New Issue
Block a user