debug sendMessage

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

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

@ -38,7 +38,8 @@
{{membershipEvents[event.content.membership]}} {{membershipEvents[event.content.membership]}}
<span class="time">{{getTime(event.origin_server_ts)}}</span> <span class="time">{{getTime(event.origin_server_ts)}}</span>
</div> </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> </div>
</div> </div>

@ -59,14 +59,16 @@ export class MatrixHandler {
this.loading = false; this.loading = false;
callback(); callback();
}); });
this.client.on('event', (event) => {
if (event.getType() === 'm.room.create') {
console.log(event)
}
})
} }
async sendEvent(msg, roomId){ 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'); console.log('message sent successfully');
}).catch((err) => { }).catch((err) => {
console.log(`error while sending message => ${err}`); console.log(`error while sending message => ${err}`);

Loading…
Cancel
Save