Browse Source

change singalr endpoint to be consistent with the back end

pull/315/head
cKey 4 years ago
parent
commit
99e8c56f5f
  1. 6
      vueJs/src/components/Lemon-IMUI/index.vue
  2. 4
      vueJs/src/components/Notification/components/UserNofitications.vue

6
vueJs/src/components/Lemon-IMUI/index.vue

@ -523,7 +523,7 @@ export default class extends mixins(EventBusMiXin) {
.withUrl('/signalr-hubs/signalr-hubs/messages', { accessTokenFactory: () => userToken }) .withUrl('/signalr-hubs/signalr-hubs/messages', { accessTokenFactory: () => userToken })
.withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 60000 }) .withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 60000 })
.build() .build()
this.connection.on('getChatMessage', this.handleReceiveMessage) this.connection.on('get-chat-message', this.handleReceiveMessage)
this.connection.onreconnected(() => { this.connection.onreconnected(() => {
this.handleInitIMUI() this.handleInitIMUI()
}) })
@ -592,7 +592,7 @@ export default class extends mixins(EventBusMiXin) {
}) })
const chatMessage = Message.tryParseToChatMessage(message) const chatMessage = Message.tryParseToChatMessage(message)
this.connection this.connection
.invoke('SendMessage', chatMessage) .invoke('send', chatMessage)
.then(() => { .then(() => {
imui imui
.updateMessage(message.id, message.toContactId, { .updateMessage(message.id, message.toContactId, {
@ -616,7 +616,7 @@ export default class extends mixins(EventBusMiXin) {
const imui = this.$refs.IMUI as any const imui = this.$refs.IMUI as any
const chatMessage = Message.tryParseToChatMessage(message) const chatMessage = Message.tryParseToChatMessage(message)
this.connection this.connection
.invoke('SendMessage', chatMessage) .invoke('send', chatMessage)
.then(() => { .then(() => {
setTimeout(() => { setTimeout(() => {
next() next()

4
vueJs/src/components/Notification/components/UserNofitications.vue

@ -99,7 +99,7 @@ export default class extends mixins(EventBusMiXin) {
.withUrl('/signalr-hubs/signalr-hubs/notifications', { accessTokenFactory: () => userToken }) .withUrl('/signalr-hubs/signalr-hubs/notifications', { accessTokenFactory: () => userToken })
.withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 60000 }) .withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 60000 })
.build() .build()
this.connection.on('getNotification', data => this.onNotificationReceived(data)) this.connection.on('get-notification', data => this.onNotificationReceived(data))
this.connection.onclose(error => { this.connection.onclose(error => {
console.log('signalr connection has closed, error:') console.log('signalr connection has closed, error:')
console.log(error) console.log(error)
@ -180,7 +180,7 @@ export default class extends mixins(EventBusMiXin) {
} }
private handleClickNotification(notificationId: string) { private handleClickNotification(notificationId: string) {
this.connection.invoke('ChangeState', notificationId, ReadState.Read).then(() => { this.connection.invoke('change-state', notificationId, ReadState.Read).then(() => {
const removeNotifyIndex = this.notifications.findIndex(n => n.id === notificationId) const removeNotifyIndex = this.notifications.findIndex(n => n.id === notificationId)
this.notifications.splice(removeNotifyIndex, 1) this.notifications.splice(removeNotifyIndex, 1)
this.trigger('onNotificationReadChanged') this.trigger('onNotificationReadChanged')

Loading…
Cancel
Save