Show error text if you can't connect to the local server

This commit is contained in:
RemixDev 2022-07-29 19:56:15 +02:00
parent 71eb7a9949
commit 5fcdd07be4

View file

@ -13,7 +13,7 @@
</div>
<BaseLoadingPlaceholder
text="Connecting to local server..."
:text=loadingText
:hidden="isSocketConnected"
additional-classes="absolute top-0 left-0 w-screen h-screen bg-black bg-opacity-50 z-50"
/>
@ -55,7 +55,8 @@ export default {
},
data() {
return {
isSocketConnected: false
isSocketConnected: false,
loadingText: "Connecting to local server..."
}
},
mounted() {
@ -64,6 +65,10 @@ export default {
console.log('Connected to WebSocket')
this.isSocketConnected = true
})
socket.addEventListener('error', (event) => {
console.log(event)
this.loadingText = "Couldn't connect to local server."
})
}
}
</script>