aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/__layout.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/__layout.svelte')
-rw-r--r--src/routes/__layout.svelte19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte
index 0168bb7c..f5576edd 100644
--- a/src/routes/__layout.svelte
+++ b/src/routes/__layout.svelte
@@ -1,24 +1,9 @@
<script>
import '../app.css';
import { onMount } from 'svelte';
- import { rate, ws } from "$lib/store";
- import { messages } from "$lib/socket";
+ import { connect } from '$lib/socket';
- let token =
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImJvYiIsImlhdCI6MTY1ODc5NDkxMX0._zFTEADrbLffcXa5sIMrJtJ483VdIiYmsdt2ofibxu4';
-
- onMount(async () => {
- $ws = new WebSocket(`ws://localhost:3119/ws`);
-
- $ws.onmessage = (msg) => {
- let { type, data } = JSON.parse(msg.data);
- messages(data)[type] && messages(data)[type]();
- };
-
- $ws.onopen = () => {
- ws.send(JSON.stringify({ type: 'login', data: token }));
- };
- });
+ onMount(connect);
</script>
<slot />