From 09693b979efe3c9c7ea64f79d97a1f0b53f7c49e Mon Sep 17 00:00:00 2001
From: Melonai <einebeere@gmail.com>
Date: Sat, 8 May 2021 23:41:03 +0200
Subject: Socket connection and token fetching

---
 assets/src/components/IncomingRequests.svelte | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 assets/src/components/IncomingRequests.svelte

(limited to 'assets/src/components/IncomingRequests.svelte')

diff --git a/assets/src/components/IncomingRequests.svelte b/assets/src/components/IncomingRequests.svelte
new file mode 100644
index 0000000..1db50af
--- /dev/null
+++ b/assets/src/components/IncomingRequests.svelte
@@ -0,0 +1,20 @@
+<script lang="ts">
+    import { getToken, joinShareChannel } from "../network/socket";
+    import requests from "../stores/requests";
+
+    const startConnection = async () => {
+        const token = await getToken();
+        joinShareChannel(token);
+        return token;
+    };
+</script>
+
+{#await startConnection()}
+    <h3>Fetching token...</h3>
+{:then token}
+    <h3>Your token is <b>{token}</b>.</h3>
+
+    {#each $requests as request}
+        <p>{JSON.stringify(request)}</p>
+    {/each}
+{/await}
-- 
cgit 1.4.1

