auth
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
import '../app.css';
|
||||
import { ModeWatcher } from 'mode-watcher';
|
||||
import { ChatSocket } from '$lib/socket';
|
||||
import { onMount } from 'svelte';
|
||||
import { onMount, type Snippet } from 'svelte';
|
||||
import { browser } from '$app/environment';
|
||||
import { setMessageStore } from '$lib/message.svelte';
|
||||
import type { LayoutServerData } from './$types.js';
|
||||
|
||||
let { children } = $props();
|
||||
interface Props {
|
||||
children: Snippet;
|
||||
data: LayoutServerData;
|
||||
}
|
||||
|
||||
let { children, data } = $props();
|
||||
|
||||
let socket;
|
||||
|
||||
@@ -14,7 +20,7 @@
|
||||
|
||||
onMount(() => {
|
||||
if (browser) {
|
||||
socket = new ChatSocket('ws://localhost:3000/ws', store);
|
||||
socket = new ChatSocket(`ws://localhost:3000/ws?token=${data.token}`, store);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user