Files
shadowrun-server/frontend/build/_app/immutable/nodes/2.ClPVIoAO.js

2 lines
1.3 KiB
JavaScript

import{f as w,a as d}from"../chunks/K5GTgIDA.js";import{i as J}from"../chunks/DgU0EQmz.js";import{z as O,A as t,B as P,C as r,D as o,F as i,G as v,I as g,J as b,K as S}from"../chunks/DxMC-E2z.js";import{e as T,s as j}from"../chunks/V6M2jInR.js";import{i as z}from"../chunks/BJWcdj5l.js";import{r as h}from"../chunks/HgGInnYf.js";import{b as _}from"../chunks/Cp1RMksV.js";import{g as A}from"../chunks/BEXiALSO.js";var B=w('<p class="error svelte-1uha8ag"> </p>'),D=w('<form class="login svelte-1uha8ag"><h2>Login</h2> <label class="svelte-1uha8ag">User <input type="text" required/></label> <label class="svelte-1uha8ag">Password <input type="password" required/></label> <button>Login</button> <!></form>');function M(y,x){O(x,!1);let s=v(""),e=v({username:"",password:""});async function k(){try{const a=await fetch("/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t(e))});if(!a.ok){b(s,await a.text());return}A("/shadowrun")}catch(a){b(s,a.message)}}J();var n=D(),l=r(o(n),2),u=r(o(l));h(u),i(l);var p=r(l,2),f=r(o(p));h(f),i(p);var c=r(p,2),C=r(c,2);{var L=a=>{var m=B(),q=o(m,!0);i(m),S(()=>j(q,t(s))),d(a,m)};z(C,a=>{t(s)&&a(L)})}i(n),_(u,()=>t(e).username,a=>g(e,t(e).username=a)),_(f,()=>t(e).password,a=>g(e,t(e).password=a)),T("click",c,k),d(y,n),P()}export{M as component};