debug sendMessage

add-admin-interface
adb 3 years ago
parent 4f5f03f65f
commit 035f30936e

@ -38,8 +38,8 @@ export default {
async sendMessage(){
if (this.msg.content.body !== "") {
let msgSend = Object.assign({}, this.msg);
await matrix.sendEvent(msgSend, this.roomId);
this.msg.content.body = "";
await matrix.sendEvent(msgSend, this.roomId);
let id = this.$refs.newMessageInput;
id.style.height = "1.25rem";
this.onResize(id.parentElement.clientHeight);

@ -38,7 +38,8 @@
{{membershipEvents[event.content.membership]}}
<span class="time">{{getTime(event.origin_server_ts)}}</span>
</div>
<div v-else class="info">unknown event</div>
<div v-else class="info">unknown event
<span class="time">{{getTime(event.origin_server_ts)}}</span></div>
</div>
</div>
</div>

@ -59,14 +59,16 @@ export class MatrixHandler {
this.loading = false;
callback();
});
this.client.on('event', (event) => {
if (event.getType() === 'm.room.create') {
console.log(event)
}
})
}
async sendEvent(msg, roomId){
await this.client.sendEvent(roomId, msg.type, msg.content, '').then(() => {
const msgSend = {
type: msg.type,
content: {
body: msg.content.body,
msgtype: msg.content.msgtype,
},
};
await this.client.sendEvent(roomId, msgSend.type, msgSend.content, '').then(() => {
console.log('message sent successfully');
}).catch((err) => {
console.log(`error while sending message => ${err}`);

Loading…
Cancel
Save