Skip to content

Commit

Permalink
Reshow SSE toast if reconnection attempt fails
Browse files Browse the repository at this point in the history
Note that this commit only works correctly together with another PR.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Mar 27, 2023
1 parent a74318c commit 03780c5
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions bundles/org.openhab.ui/web/src/components/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,6 @@ export default {
try {
window.OHApp.sseConnected(connected)
} catch {}
} else if (this.$f7) {
if (connected === false) {
this.sseFailureToast = this.displayFailureToast(this.$t('error.sseConnectionFailed'), true, false)
} else if (connected === true) {
if (this.sseFailureToast !== null) {
this.sseFailureToast.close()
this.sseFailureToast = null
}
}
}
},
immediate: true // provides initial (not changed yet) state
Expand Down Expand Up @@ -788,6 +779,23 @@ export default {
}
})
this.$store.subscribe((mutation, state) => {
if (mutation.type === 'sseConnected') {
if (!window.OHApp && this.$f7) {
if (mutation.payload === false) {
if (this.sseFailureToast === null) this.sseFailureToast = this.displayFailureToast(this.$t('error.sseConnectionFailed'), true, false)
this.sseFailureToast.open()
} else if (mutation.payload === true) {
if (this.sseFailureToast !== null) {
this.sseFailureToast.close()
this.sseFailureToast.destroy()
this.sseFailureToast = null
}
}
}
}
})
this.$store.subscribeAction({
error: (action, state, error) => {
if (action.type === 'sendCommand') {
Expand Down

0 comments on commit 03780c5

Please sign in to comment.