mirror of
https://github.com/axllent/mailpit.git
synced 2025-01-30 04:30:56 +02:00
Fix: Prevent rare error from websocket connection (unexpected non-whitespace character)
This commit is contained in:
parent
dd57596fd1
commit
381813fe63
@ -41,10 +41,13 @@ export default {
|
||||
let ws = new WebSocket(this.socketURI)
|
||||
let self = this
|
||||
ws.onmessage = function (e) {
|
||||
let response = JSON.parse(e.data)
|
||||
if (!response) {
|
||||
let response
|
||||
try {
|
||||
response = JSON.parse(e.data)
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
|
||||
// new messages
|
||||
if (response.Type == "new" && response.Data) {
|
||||
if (!mailbox.searching) {
|
||||
@ -88,7 +91,7 @@ export default {
|
||||
|
||||
// detect version updated, refresh is needed
|
||||
if (self.version != response.Data.Version) {
|
||||
location.reload();
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user