From 3eafb413a48cde60dea8a7355ee621c6acca952f Mon Sep 17 00:00:00 2001
From: Doog <157747121+doogongithub@users.noreply.github.com>
Date: Wed, 21 Feb 2024 22:07:27 -0500
Subject: first commit

---
 fe/src/App.svelte | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 167 insertions(+)
 create mode 100644 fe/src/App.svelte

(limited to 'fe/src/App.svelte')

diff --git a/fe/src/App.svelte b/fe/src/App.svelte
new file mode 100644
index 0000000..cc4e594
--- /dev/null
+++ b/fe/src/App.svelte
@@ -0,0 +1,167 @@
+<script lang="ts">
+    import {onMount} from 'svelte';
+    import svelteLogo from './assets/svelte.svg'
+    import viteLogo from '/vite.svg'
+    import Counter from './lib/Counter.svelte'
+    import Table from './lib/Table.svelte'
+    import Card from './lib/Card.svelte'
+    import { UnauthorizedError } from './lib/errors';
+ 
+    let data;
+    let error;
+
+    let user = {
+        username: '',
+        password: ''
+    }
+
+    interface CredentialObject {
+        username: string;
+        password: string;
+    }
+
+    function sleep(ms) {
+        return new Promise(resolve => setTimeout(resolve, ms));
+    }
+
+    async function getData() {
+        const res = await fetch('http://localhost:8080/api/v1/stats/');
+        if (res.ok) {
+            await sleep(3000);
+            return await res.json();
+        } else {
+            throw new Error('There was a problem with your request');
+        }
+    }
+
+    function handleClick () {
+      data = getData();
+    } 
+    
+    let authenticated: boolean = false;
+
+    function prepareCredentials ({ username, password }: CredentialObject): string {
+        return btoa(`${username}:${password}`);
+    }
+
+
+    async function onSubmit(e) {
+        if (!user.username || !user.password) {
+            error = 'please enter your username and password';
+            return;
+        }
+       const auth = prepareCredentials(user);
+
+       const response = await fetch('http://localhost:8080/api/v1/auth', {
+            method: 'POST',
+            headers: {
+                'Authorization': `Basic ${auth}`,
+            },
+       });
+
+        if (response.status === 401) {
+            error = "Your username or password is wrong";
+            return;
+        }
+
+        if (response.ok) {
+            const { token } = await response.json();
+            console.log(token);
+            localStorage.user = JSON.stringify(user);
+            localStorage.token = token;
+            authenticated = true;
+        }
+        
+
+        error = null;
+    }
+
+    function logout() {
+        localStorage.removeItem("user");
+        localStorage.removeItem("token");
+        authenticated = false;
+    }
+
+
+    onMount(() => {
+        if (localStorage.token) {
+            authenticated = true;
+        } 
+    });
+</script>
+
+<main>
+    {#if !authenticated}
+        <Card>
+            <form class="form" on:submit|preventDefault={onSubmit}>
+                <div class='form input group'>
+                    <label for="username">Username</label>
+                    <input bind:value={user.username} id="username" name='username' type="text" />
+                </div>
+                <div class='form input group'>
+                    <label for="password">Password</label>
+                    <input bind:value={user.password} id="password" name='password' type="password" />
+                </div>
+                {#if error}
+                    <p class="error">{error}</p>
+                {/if}
+                <button type="submit">Log in</button>
+            </form>
+        </Card>
+    {:else}
+        <div>
+            <button on:click={logout}>Logout</button>
+        </div>
+      <div>
+        <a href="https://vitejs.dev" target="_blank" rel="noreferrer">
+          <img src={viteLogo} class="logo" alt="Vite Logo" />
+        </a>
+        <a href="https://svelte.dev" target="_blank" rel="noreferrer">
+          <img src={svelteLogo} class="logo svelte" alt="Svelte Logo" />
+        </a>
+      </div>
+
+      <button on:click={handleClick}>
+        Get Data
+      </button>
+
+      {#await data}
+        <p>...fetching</p>
+      {:then data}
+        {#if data}
+            <p>Status</p>
+            <p>{data.status}</p>
+            <Table />
+            <Table nofooter title="No Footer"/>
+            <Table noheader title="No Header"/>
+        {:else}
+            <p>No data yet</p>
+        {/if}
+      {:catch errror}
+        <p>{error.message}</p>
+      {/await}
+    {/if} 
+</main>
+
+<style>
+  .logo {
+    height: 6em;
+    padding: 1.5em;
+    will-change: filter;
+    transition: filter 300ms;
+  }
+  .logo:hover {
+    filter: drop-shadow(0 0 2em #646cffaa);
+  }
+  .logo.svelte:hover {
+    filter: drop-shadow(0 0 2em #ff3e00aa);
+  }
+  .read-the-docs {
+    color: #888;
+  }
+  
+  .error {
+    font-size: 0.75em;
+    color: red;
+  }
+</style>
-- 
cgit v1.1


From e37c73e33a4aaf7fb8d25b5af03627f20bcda19f Mon Sep 17 00:00:00 2001
From: Doog <157747121+doogongithub@users.noreply.github.com>
Date: Sat, 24 Feb 2024 20:08:35 -0500
Subject: add gitignore

---
 fe/src/App.svelte | 147 ++++--------------------------------------------------
 1 file changed, 10 insertions(+), 137 deletions(-)

(limited to 'fe/src/App.svelte')

diff --git a/fe/src/App.svelte b/fe/src/App.svelte
index cc4e594..8811c52 100644
--- a/fe/src/App.svelte
+++ b/fe/src/App.svelte
@@ -1,146 +1,19 @@
 <script lang="ts">
-    import {onMount} from 'svelte';
-    import svelteLogo from './assets/svelte.svg'
-    import viteLogo from '/vite.svg'
-    import Counter from './lib/Counter.svelte'
-    import Table from './lib/Table.svelte'
-    import Card from './lib/Card.svelte'
-    import { UnauthorizedError } from './lib/errors';
- 
-    let data;
-    let error;
-
-    let user = {
-        username: '',
-        password: ''
-    }
-
-    interface CredentialObject {
-        username: string;
-        password: string;
-    }
-
-    function sleep(ms) {
-        return new Promise(resolve => setTimeout(resolve, ms));
-    }
-
-    async function getData() {
-        const res = await fetch('http://localhost:8080/api/v1/stats/');
-        if (res.ok) {
-            await sleep(3000);
-            return await res.json();
-        } else {
-            throw new Error('There was a problem with your request');
-        }
-    }
-
-    function handleClick () {
-      data = getData();
-    } 
-    
-    let authenticated: boolean = false;
-
-    function prepareCredentials ({ username, password }: CredentialObject): string {
-        return btoa(`${username}:${password}`);
-    }
-
-
-    async function onSubmit(e) {
-        if (!user.username || !user.password) {
-            error = 'please enter your username and password';
-            return;
-        }
-       const auth = prepareCredentials(user);
-
-       const response = await fetch('http://localhost:8080/api/v1/auth', {
-            method: 'POST',
-            headers: {
-                'Authorization': `Basic ${auth}`,
-            },
-       });
-
-        if (response.status === 401) {
-            error = "Your username or password is wrong";
-            return;
-        }
-
-        if (response.ok) {
-            const { token } = await response.json();
-            console.log(token);
-            localStorage.user = JSON.stringify(user);
-            localStorage.token = token;
-            authenticated = true;
-        }
-        
-
-        error = null;
-    }
-
-    function logout() {
-        localStorage.removeItem("user");
-        localStorage.removeItem("token");
-        authenticated = false;
-    }
-
-
-    onMount(() => {
-        if (localStorage.token) {
-            authenticated = true;
-        } 
-    });
+    import { onMount, onDestroy } from 'svelte';
+    import Layout from './lib/Layout.svelte'
+    import LoginForm from './lib/LoginForm.svelte';
+    import DataView from './lib/DataView.svelte';
+    import { authenticated } from './stores/auth';
 </script>
 
 <main>
-    {#if !authenticated}
-        <Card>
-            <form class="form" on:submit|preventDefault={onSubmit}>
-                <div class='form input group'>
-                    <label for="username">Username</label>
-                    <input bind:value={user.username} id="username" name='username' type="text" />
-                </div>
-                <div class='form input group'>
-                    <label for="password">Password</label>
-                    <input bind:value={user.password} id="password" name='password' type="password" />
-                </div>
-                {#if error}
-                    <p class="error">{error}</p>
-                {/if}
-                <button type="submit">Log in</button>
-            </form>
-        </Card>
+    <Layout>
+    {#if !$authenticated}
+        <LoginForm />
     {:else}
-        <div>
-            <button on:click={logout}>Logout</button>
-        </div>
-      <div>
-        <a href="https://vitejs.dev" target="_blank" rel="noreferrer">
-          <img src={viteLogo} class="logo" alt="Vite Logo" />
-        </a>
-        <a href="https://svelte.dev" target="_blank" rel="noreferrer">
-          <img src={svelteLogo} class="logo svelte" alt="Svelte Logo" />
-        </a>
-      </div>
-
-      <button on:click={handleClick}>
-        Get Data
-      </button>
-
-      {#await data}
-        <p>...fetching</p>
-      {:then data}
-        {#if data}
-            <p>Status</p>
-            <p>{data.status}</p>
-            <Table />
-            <Table nofooter title="No Footer"/>
-            <Table noheader title="No Header"/>
-        {:else}
-            <p>No data yet</p>
-        {/if}
-      {:catch errror}
-        <p>{error.message}</p>
-      {/await}
+        <DataView />
     {/if} 
+    </Layout>
 </main>
 
 <style>
-- 
cgit v1.1


From afeffe31bd7d0f8333627a972e1d32e64a325b5b Mon Sep 17 00:00:00 2001
From: Zach Berwaldt <zberwaldt@tutamail.com>
Date: Fri, 1 Mar 2024 18:17:42 -0500
Subject: reformat fe

---
 fe/src/App.svelte | 42 +++++++++---------------------------------
 1 file changed, 9 insertions(+), 33 deletions(-)

(limited to 'fe/src/App.svelte')

diff --git a/fe/src/App.svelte b/fe/src/App.svelte
index 8811c52..25d53dc 100644
--- a/fe/src/App.svelte
+++ b/fe/src/App.svelte
@@ -1,40 +1,16 @@
 <script lang="ts">
-    import { onMount, onDestroy } from 'svelte';
-    import Layout from './lib/Layout.svelte'
-    import LoginForm from './lib/LoginForm.svelte';
-    import DataView from './lib/DataView.svelte';
-    import { authenticated } from './stores/auth';
+  import Layout from "./lib/Layout.svelte";
+  import LoginForm from "./lib/LoginForm.svelte";
+  import DataView from "./lib/DataView.svelte";
+  import { authenticated } from "./stores/auth";
 </script>
 
 <main>
-    <Layout>
+  <Layout>
     {#if !$authenticated}
-        <LoginForm />
+      <LoginForm />
     {:else}
-        <DataView />
-    {/if} 
-    </Layout>
+      <DataView />
+    {/if}
+  </Layout>
 </main>
-
-<style>
-  .logo {
-    height: 6em;
-    padding: 1.5em;
-    will-change: filter;
-    transition: filter 300ms;
-  }
-  .logo:hover {
-    filter: drop-shadow(0 0 2em #646cffaa);
-  }
-  .logo.svelte:hover {
-    filter: drop-shadow(0 0 2em #ff3e00aa);
-  }
-  .read-the-docs {
-    color: #888;
-  }
-  
-  .error {
-    font-size: 0.75em;
-    color: red;
-  }
-</style>
-- 
cgit v1.1

