room load old message but pbm to read them
This commit is contained in:
@@ -3903,7 +3903,7 @@ var app = (function () {
|
||||
return child_ctx;
|
||||
}
|
||||
|
||||
// (45:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
||||
// (50:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
||||
function create_default_slot_3$5(ctx) {
|
||||
let t;
|
||||
|
||||
@@ -3923,14 +3923,14 @@ var app = (function () {
|
||||
block,
|
||||
id: create_default_slot_3$5.name,
|
||||
type: "slot",
|
||||
source: "(45:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
||||
source: "(50:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (50:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
||||
// (55:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
||||
function create_default_slot_2$9(ctx) {
|
||||
let t;
|
||||
|
||||
@@ -3950,14 +3950,14 @@ var app = (function () {
|
||||
block,
|
||||
id: create_default_slot_2$9.name,
|
||||
type: "slot",
|
||||
source: "(50:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
||||
source: "(55:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (55:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||
// (60:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||
function create_default_slot_1$9(ctx) {
|
||||
let t;
|
||||
|
||||
@@ -3977,7 +3977,7 @@ var app = (function () {
|
||||
block,
|
||||
id: create_default_slot_1$9.name,
|
||||
type: "slot",
|
||||
source: "(55:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||
source: "(60:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||
ctx
|
||||
});
|
||||
|
||||
@@ -4006,7 +4006,7 @@ var app = (function () {
|
||||
return block;
|
||||
}
|
||||
|
||||
// (69:3) {:then}
|
||||
// (74:3) {:then}
|
||||
function create_then_block$1(ctx) {
|
||||
let each_1_anchor;
|
||||
let current;
|
||||
@@ -4039,7 +4039,7 @@ var app = (function () {
|
||||
current = true;
|
||||
},
|
||||
p: function update(ctx, dirty) {
|
||||
if (dirty & /*layout, rooms*/ 3) {
|
||||
if (dirty & /*get_room_messages, rooms*/ 10) {
|
||||
each_value = /*rooms*/ ctx[1];
|
||||
validate_each_argument(each_value);
|
||||
let i;
|
||||
@@ -4095,14 +4095,14 @@ var app = (function () {
|
||||
block,
|
||||
id: create_then_block$1.name,
|
||||
type: "then",
|
||||
source: "(69:3) {:then}",
|
||||
source: "(74:3) {:then}",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (71:5) <Button bind:layout new_layout="room" my_class="list">
|
||||
// (76:5) <Button my_class="list" on_click={get_room_messages}>
|
||||
function create_default_slot$b(ctx) {
|
||||
let t0_value = /*room*/ ctx[7].name + "";
|
||||
let t0;
|
||||
@@ -4130,36 +4130,27 @@ var app = (function () {
|
||||
block,
|
||||
id: create_default_slot$b.name,
|
||||
type: "slot",
|
||||
source: "(71:5) <Button bind:layout new_layout=\\\"room\\\" my_class=\\\"list\\\">",
|
||||
source: "(76:5) <Button my_class=\\\"list\\\" on_click={get_room_messages}>",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (70:4) {#each rooms as room}
|
||||
// (75:4) {#each rooms as room}
|
||||
function create_each_block$5(ctx) {
|
||||
let button;
|
||||
let updating_layout;
|
||||
let current;
|
||||
|
||||
function button_layout_binding(value) {
|
||||
/*button_layout_binding*/ ctx[6](value);
|
||||
}
|
||||
|
||||
let button_props = {
|
||||
new_layout: "room",
|
||||
my_class: "list",
|
||||
$$slots: { default: [create_default_slot$b] },
|
||||
$$scope: { ctx }
|
||||
};
|
||||
|
||||
if (/*layout*/ ctx[0] !== void 0) {
|
||||
button_props.layout = /*layout*/ ctx[0];
|
||||
}
|
||||
|
||||
button = new Chat_button({ props: button_props, $$inline: true });
|
||||
binding_callbacks.push(() => bind(button, 'layout', button_layout_binding));
|
||||
button = new Chat_button({
|
||||
props: {
|
||||
my_class: "list",
|
||||
on_click: /*get_room_messages*/ ctx[3],
|
||||
$$slots: { default: [create_default_slot$b] },
|
||||
$$scope: { ctx }
|
||||
},
|
||||
$$inline: true
|
||||
});
|
||||
|
||||
const block = {
|
||||
c: function create() {
|
||||
@@ -4176,12 +4167,6 @@ var app = (function () {
|
||||
button_changes.$$scope = { dirty, ctx };
|
||||
}
|
||||
|
||||
if (!updating_layout && dirty & /*layout*/ 1) {
|
||||
updating_layout = true;
|
||||
button_changes.layout = /*layout*/ ctx[0];
|
||||
add_flush_callback(() => updating_layout = false);
|
||||
}
|
||||
|
||||
button.$set(button_changes);
|
||||
},
|
||||
i: function intro(local) {
|
||||
@@ -4202,14 +4187,14 @@ var app = (function () {
|
||||
block,
|
||||
id: create_each_block$5.name,
|
||||
type: "each",
|
||||
source: "(70:4) {#each rooms as room}",
|
||||
source: "(75:4) {#each rooms as room}",
|
||||
ctx
|
||||
});
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// (66:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
||||
// (71:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
||||
function create_pending_block$1(ctx) {
|
||||
let p;
|
||||
|
||||
@@ -4217,7 +4202,7 @@ var app = (function () {
|
||||
c: function create() {
|
||||
p = element("p");
|
||||
p.textContent = "rooms are loaded...";
|
||||
add_location(p, file$p, 67, 4, 1409);
|
||||
add_location(p, file$p, 72, 4, 1510);
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
insert_dev(target, p, anchor);
|
||||
@@ -4234,7 +4219,7 @@ var app = (function () {
|
||||
block,
|
||||
id: create_pending_block$1.name,
|
||||
type: "pending",
|
||||
source: "(66:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
||||
source: "(71:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
||||
ctx
|
||||
});
|
||||
|
||||
@@ -4262,7 +4247,7 @@ var app = (function () {
|
||||
let current;
|
||||
|
||||
function button0_layout_binding(value) {
|
||||
/*button0_layout_binding*/ ctx[3](value);
|
||||
/*button0_layout_binding*/ ctx[4](value);
|
||||
}
|
||||
|
||||
let button0_props = {
|
||||
@@ -4280,7 +4265,7 @@ var app = (function () {
|
||||
binding_callbacks.push(() => bind(button0, 'layout', button0_layout_binding));
|
||||
|
||||
function button1_layout_binding(value) {
|
||||
/*button1_layout_binding*/ ctx[4](value);
|
||||
/*button1_layout_binding*/ ctx[5](value);
|
||||
}
|
||||
|
||||
let button1_props = {
|
||||
@@ -4298,7 +4283,7 @@ var app = (function () {
|
||||
binding_callbacks.push(() => bind(button1, 'layout', button1_layout_binding));
|
||||
|
||||
function button2_layout_binding(value) {
|
||||
/*button2_layout_binding*/ ctx[5](value);
|
||||
/*button2_layout_binding*/ ctx[6](value);
|
||||
}
|
||||
|
||||
let button2_props = {
|
||||
@@ -4348,17 +4333,17 @@ var app = (function () {
|
||||
t6 = space();
|
||||
info.block.c();
|
||||
attr_dev(p0, "class", "title svelte-1jygwt2");
|
||||
add_location(p0, file$p, 60, 2, 1177);
|
||||
add_location(p0, file$p, 65, 2, 1278);
|
||||
attr_dev(p1, "class", "__center");
|
||||
add_location(p1, file$p, 63, 4, 1287);
|
||||
add_location(p1, file$p, 68, 4, 1388);
|
||||
attr_dev(div0, "class", "__show_if_only_child");
|
||||
add_location(div0, file$p, 62, 3, 1248);
|
||||
add_location(div0, file$p, 67, 3, 1349);
|
||||
attr_dev(div1, "class", "room_list");
|
||||
add_location(div1, file$p, 61, 2, 1221);
|
||||
add_location(div1, file$p, 66, 2, 1322);
|
||||
attr_dev(div2, "class", "panel panel_home __border_top svelte-1jygwt2");
|
||||
add_location(div2, file$p, 59, 1, 1131);
|
||||
add_location(div2, file$p, 64, 1, 1232);
|
||||
attr_dev(div3, "class", "grid_box svelte-1jygwt2");
|
||||
add_location(div3, file$p, 41, 0, 772);
|
||||
add_location(div3, file$p, 46, 0, 873);
|
||||
},
|
||||
l: function claim(nodes) {
|
||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||
@@ -4468,6 +4453,10 @@ var app = (function () {
|
||||
return block;
|
||||
}
|
||||
|
||||
function test() {
|
||||
console.log("test");
|
||||
}
|
||||
|
||||
function instance$s($$self, $$props, $$invalidate) {
|
||||
let { $$slots: slots = {}, $$scope } = $$props;
|
||||
validate_slots('Layout_home', slots, []);
|
||||
@@ -4482,11 +4471,22 @@ var app = (function () {
|
||||
|
||||
// ask api for the rooms
|
||||
const get_rooms = fetch('/api/v2/chat/rooms').then(resp => resp.json()).then(data => {
|
||||
console.log(data.rooms);
|
||||
console.log("data.rooms:", data.rooms);
|
||||
for (let room of data.rooms) console.log(room.name);
|
||||
$$invalidate(1, rooms = data.rooms);
|
||||
});
|
||||
|
||||
function get_room_messages() {
|
||||
console.log("in get_room_messages");
|
||||
|
||||
fetch('/api/v2/chat/messages').then(resp => resp.json()).then(data => {
|
||||
console.log(data.messages);
|
||||
msgs.update(msgs => msgs.concat(data.messages));
|
||||
});
|
||||
|
||||
$$invalidate(0, layout = "room");
|
||||
}
|
||||
|
||||
$$self.$$.on_mount.push(function () {
|
||||
if (layout === undefined && !('layout' in $$props || $$self.$$.bound[$$self.$$.props['layout']])) {
|
||||
console_1$9.warn("<Layout_home> was created without expected prop 'layout'");
|
||||
@@ -4514,11 +4514,6 @@ var app = (function () {
|
||||
$$invalidate(0, layout);
|
||||
}
|
||||
|
||||
function button_layout_binding(value) {
|
||||
layout = value;
|
||||
$$invalidate(0, layout);
|
||||
}
|
||||
|
||||
$$self.$$set = $$props => {
|
||||
if ('layout' in $$props) $$invalidate(0, layout = $$props.layout);
|
||||
};
|
||||
@@ -4529,7 +4524,9 @@ var app = (function () {
|
||||
msgs,
|
||||
layout,
|
||||
rooms,
|
||||
get_rooms
|
||||
get_rooms,
|
||||
get_room_messages,
|
||||
test
|
||||
});
|
||||
|
||||
$$self.$inject_state = $$props => {
|
||||
@@ -4545,10 +4542,10 @@ var app = (function () {
|
||||
layout,
|
||||
rooms,
|
||||
get_rooms,
|
||||
get_room_messages,
|
||||
button0_layout_binding,
|
||||
button1_layout_binding,
|
||||
button2_layout_binding,
|
||||
button_layout_binding
|
||||
button2_layout_binding
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10952,10 +10949,10 @@ var app = (function () {
|
||||
t1 = space();
|
||||
input = element("input");
|
||||
attr_dev(p, "class", "svelte-1b1eu8h");
|
||||
add_location(p, file$h, 82, 28, 2616);
|
||||
add_location(p, file$h, 82, 28, 2618);
|
||||
attr_dev(label, "for", "chat_pswd");
|
||||
attr_dev(label, "class", "svelte-1b1eu8h");
|
||||
add_location(label, file$h, 82, 5, 2593);
|
||||
add_location(label, file$h, 82, 5, 2595);
|
||||
attr_dev(input, "id", "chat_pswd");
|
||||
attr_dev(input, "type", "password");
|
||||
attr_dev(input, "placeholder", "minimum 8 characters");
|
||||
@@ -10963,9 +10960,9 @@ var app = (function () {
|
||||
attr_dev(input, "name", "password");
|
||||
input.required = true;
|
||||
attr_dev(input, "class", "svelte-1b1eu8h");
|
||||
add_location(input, file$h, 83, 5, 2656);
|
||||
add_location(input, file$h, 83, 5, 2658);
|
||||
attr_dev(div, "class", "svelte-1b1eu8h");
|
||||
add_location(div, file$h, 81, 4, 2582);
|
||||
add_location(div, file$h, 81, 4, 2584);
|
||||
},
|
||||
m: function mount(target, anchor) {
|
||||
insert_dev(target, div, anchor);
|
||||
@@ -11131,17 +11128,17 @@ var app = (function () {
|
||||
t16 = space();
|
||||
input4 = element("input");
|
||||
attr_dev(p0, "class", "svelte-1b1eu8h");
|
||||
add_location(p0, file$h, 62, 26, 1779);
|
||||
add_location(p0, file$h, 62, 26, 1781);
|
||||
attr_dev(label0, "for", "chat_name");
|
||||
attr_dev(label0, "class", "svelte-1b1eu8h");
|
||||
add_location(label0, file$h, 62, 3, 1756);
|
||||
add_location(label0, file$h, 62, 3, 1758);
|
||||
attr_dev(input0, "id", "chat_name");
|
||||
attr_dev(input0, "name", "room_name");
|
||||
input0.required = true;
|
||||
attr_dev(input0, "class", "svelte-1b1eu8h");
|
||||
add_location(input0, file$h, 63, 3, 1813);
|
||||
add_location(input0, file$h, 63, 3, 1815);
|
||||
attr_dev(p1, "class", "svelte-1b1eu8h");
|
||||
add_location(p1, file$h, 66, 4, 1956);
|
||||
add_location(p1, file$h, 66, 4, 1958);
|
||||
attr_dev(input1, "id", "chat_public");
|
||||
attr_dev(input1, "type", "radio");
|
||||
attr_dev(input1, "name", "room_type");
|
||||
@@ -11150,12 +11147,12 @@ var app = (function () {
|
||||
input1.required = true;
|
||||
attr_dev(input1, "class", "svelte-1b1eu8h");
|
||||
/*$$binding_groups*/ ctx[12][0].push(input1);
|
||||
add_location(input1, file$h, 67, 4, 1974);
|
||||
add_location(input1, file$h, 67, 4, 1976);
|
||||
attr_dev(label1, "for", "chat_public");
|
||||
attr_dev(label1, "class", "_radio svelte-1b1eu8h");
|
||||
add_location(label1, file$h, 65, 3, 1911);
|
||||
add_location(label1, file$h, 65, 3, 1913);
|
||||
attr_dev(p2, "class", "svelte-1b1eu8h");
|
||||
add_location(p2, file$h, 71, 4, 2162);
|
||||
add_location(p2, file$h, 71, 4, 2164);
|
||||
attr_dev(input2, "id", "chat_private");
|
||||
attr_dev(input2, "type", "radio");
|
||||
attr_dev(input2, "name", "room_type");
|
||||
@@ -11164,12 +11161,12 @@ var app = (function () {
|
||||
input2.required = true;
|
||||
attr_dev(input2, "class", "svelte-1b1eu8h");
|
||||
/*$$binding_groups*/ ctx[12][0].push(input2);
|
||||
add_location(input2, file$h, 72, 4, 2181);
|
||||
add_location(input2, file$h, 72, 4, 2183);
|
||||
attr_dev(label2, "for", "chat_private");
|
||||
attr_dev(label2, "class", "_radio svelte-1b1eu8h");
|
||||
add_location(label2, file$h, 70, 3, 2116);
|
||||
add_location(label2, file$h, 70, 3, 2118);
|
||||
attr_dev(p3, "class", "svelte-1b1eu8h");
|
||||
add_location(p3, file$h, 76, 4, 2375);
|
||||
add_location(p3, file$h, 76, 4, 2377);
|
||||
attr_dev(input3, "id", "chat_protected");
|
||||
attr_dev(input3, "type", "radio");
|
||||
attr_dev(input3, "name", "room_type");
|
||||
@@ -11178,20 +11175,20 @@ var app = (function () {
|
||||
input3.required = true;
|
||||
attr_dev(input3, "class", "svelte-1b1eu8h");
|
||||
/*$$binding_groups*/ ctx[12][0].push(input3);
|
||||
add_location(input3, file$h, 77, 4, 2396);
|
||||
add_location(input3, file$h, 77, 4, 2398);
|
||||
attr_dev(label3, "for", "chat_protected");
|
||||
attr_dev(label3, "class", "_radio svelte-1b1eu8h");
|
||||
add_location(label3, file$h, 75, 3, 2327);
|
||||
add_location(label3, file$h, 75, 3, 2329);
|
||||
attr_dev(input4, "type", "submit");
|
||||
input4.value = "⮡";
|
||||
attr_dev(input4, "class", "svelte-1b1eu8h");
|
||||
add_location(input4, file$h, 86, 3, 2820);
|
||||
add_location(input4, file$h, 86, 3, 2822);
|
||||
attr_dev(form, "class", "svelte-1b1eu8h");
|
||||
add_location(form, file$h, 57, 2, 1605);
|
||||
add_location(form, file$h, 57, 2, 1607);
|
||||
attr_dev(div0, "class", "panel panel_create __border_top svelte-1b1eu8h");
|
||||
add_location(div0, file$h, 56, 1, 1557);
|
||||
add_location(div0, file$h, 56, 1, 1559);
|
||||
attr_dev(div1, "class", "grid_box svelte-1b1eu8h");
|
||||
add_location(div1, file$h, 38, 0, 1212);
|
||||
add_location(div1, file$h, 38, 0, 1214);
|
||||
},
|
||||
l: function claim(nodes) {
|
||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||
@@ -11398,7 +11395,7 @@ var app = (function () {
|
||||
console.log("formData:", formData);
|
||||
|
||||
// send the new room
|
||||
const response = await fetch('/api/v2/chat/join', {
|
||||
const response = await fetch('/api/v2/chat/create', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(formData)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user