wip load room messages, but i broke rooms list
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
.then((data) =>
|
||||
{
|
||||
user = data;
|
||||
console.log("user:", user);
|
||||
socket = io(address,
|
||||
{
|
||||
path: '/chat',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
import Button from './Chat_button.svelte';
|
||||
import { msgs } from './Store_msg.js';
|
||||
export let layout;
|
||||
|
||||
let rooms = [
|
||||
@@ -23,6 +24,19 @@
|
||||
rooms = data.rooms;
|
||||
});
|
||||
|
||||
/*
|
||||
function get_room_messages()
|
||||
{
|
||||
const messages = fetch('/api/v2/chat/messages')
|
||||
.then(resp => resp.json())
|
||||
.then(data =>
|
||||
{
|
||||
console.log(data.messages);
|
||||
msgs.update(msgs => [...msgs, { name: name, message: message }]);
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
</script>
|
||||
|
||||
<div class="grid_box">
|
||||
@@ -59,16 +73,6 @@
|
||||
</Button>
|
||||
{/each}
|
||||
{/await}
|
||||
|
||||
<!-- placeholders
|
||||
<Button bind:layout new_layout="room" my_class="list">
|
||||
another room
|
||||
</Button>
|
||||
<Button bind:layout new_layout="room" my_class="list">
|
||||
placeholder
|
||||
</Button>
|
||||
------------- -->
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
let msg = "";
|
||||
let text_area;
|
||||
|
||||
function add_local_msg(from, message)
|
||||
function add_local_msg(name, message)
|
||||
{
|
||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
||||
msgs.update(msgs => [...msgs, { name: name, message: message }]);
|
||||
}
|
||||
|
||||
function send_msg()
|
||||
@@ -61,7 +61,7 @@
|
||||
<div class="panel panel_msg">
|
||||
<div class="msg_thread">
|
||||
{#each $msgs as msg}
|
||||
<Msg name={msg.name}>{@html msg.content}</Msg>
|
||||
<Msg name={msg.name}>{@html msg.message}</Msg>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user