home rooms are charging correctly
This commit is contained in:
@@ -12,16 +12,15 @@
|
||||
{room_name: 'ho room'},
|
||||
];
|
||||
|
||||
// ask for the rooms
|
||||
onMount(() => {
|
||||
console.log("onmount");
|
||||
const get_rooms = fetch('/api/v2/chat/rooms')
|
||||
.then(resp => resp.json())
|
||||
.then(data =>
|
||||
{
|
||||
console.log(data);
|
||||
//rooms = data;
|
||||
});
|
||||
// ask api for the rooms
|
||||
const get_rooms = fetch('/api/v2/chat/rooms')
|
||||
.then(resp => resp.json())
|
||||
.then(data =>
|
||||
{
|
||||
console.log(data.rooms);
|
||||
for (let room of data.rooms)
|
||||
console.log(room.name);
|
||||
rooms = data.rooms;
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -50,11 +49,16 @@
|
||||
<div class="__show_if_only_child">
|
||||
<p class="__center">/ you have no chat room yet /</p>
|
||||
</div>
|
||||
{#each rooms as room}
|
||||
<Button bind:layout new_layout="room" my_class="list">
|
||||
{room.room_name}
|
||||
</Button>
|
||||
{/each}
|
||||
{#await get_rooms}
|
||||
<!-- promise is pending -->
|
||||
<p>rooms are loaded...</p>
|
||||
{:then}
|
||||
{#each rooms as room}
|
||||
<Button bind:layout new_layout="room" my_class="list">
|
||||
{room.name}
|
||||
</Button>
|
||||
{/each}
|
||||
{/await}
|
||||
|
||||
<!-- placeholders
|
||||
<Button bind:layout new_layout="room" my_class="list">
|
||||
|
||||
Reference in New Issue
Block a user