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