wip db request with array not working
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
let formData = {
|
||||
room_name: room_name,
|
||||
room_type: room_type,
|
||||
room_password: room_password,
|
||||
};
|
||||
console.log("formData:", formData);
|
||||
|
||||
|
||||
@@ -17,9 +17,46 @@
|
||||
rooms = data.rooms;
|
||||
});
|
||||
|
||||
function join_rooms()
|
||||
function join_rooms(evt)
|
||||
{
|
||||
console.log("inside join_rooms");
|
||||
let room_name = {
|
||||
room_name: evt.target.innerText,
|
||||
}
|
||||
|
||||
const messages = fetch('/api/v2/chat/join',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(room_name),
|
||||
})
|
||||
.then(resp => resp.json())
|
||||
.then(data =>
|
||||
{
|
||||
console.log(data);
|
||||
// data.messages.forEach(function(item) {
|
||||
// if (item.name === user.username) {
|
||||
// item.name = "me";
|
||||
// }
|
||||
// });
|
||||
// msgs.update(msgs => msgs.concat(data.messages));
|
||||
});
|
||||
|
||||
/*
|
||||
const messages = fetch('/api/v2/chat/messages')
|
||||
.then(resp => resp.json())
|
||||
.then(data =>
|
||||
{
|
||||
console.log(data.messages);
|
||||
data.messages.forEach(function(item) {
|
||||
if (item.name === user.username) {
|
||||
item.name = "me";
|
||||
}
|
||||
});
|
||||
msgs.update(msgs => msgs.concat(data.messages));
|
||||
});
|
||||
layout = "room";
|
||||
*/
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user