diff --git a/src/components/WebsocketURL.vue b/src/components/WebsocketURL.vue index d24c54c..12d6653 100644 --- a/src/components/WebsocketURL.vue +++ b/src/components/WebsocketURL.vue @@ -10,12 +10,14 @@
@@ -27,14 +29,17 @@ export default { name: 'WebsocketEntry', components: {}, data() {return { - ws_url: ``, + ws_uri: ``, + has_error: false, + ws_regex: /^(wss?|https?):\/\//, }}, methods: { - submit_ws_url() { - if (this.ws_url.length > 0 && this.ws_url.match(/^wss?:\/\//)) { - this.$emit(`set-ws-url`, this.ws_url); + submit_ws_uri() { + if (this.ws_uri.length > 0 && this.ws_uri.match(this.ws_regex)) { + this.$emit(`try-ws-uri`, this.ws_uri); } else { - alert(`Invalid websocket URL, it must begin with "wss://" in order to connect.`) + this.has_error = true; + alert(`Invalid websocket URL, please check that you typed it correctly.`) } }, },