diff --git a/src/ui/Chat.vue b/src/ui/Chat.vue
index 568e49e..3379b41 100644
--- a/src/ui/Chat.vue
+++ b/src/ui/Chat.vue
@@ -32,6 +32,10 @@
maxlength="30"
placeholder="Ditt navn.."
/>
+
+
+ {{ validationError }}
+
@@ -51,7 +55,8 @@ export default {
page: 1,
pageSize: 10,
temporaryUsername: null,
- username: null
+ username: null,
+ validationError: undefined
};
},
created() {
@@ -84,6 +89,10 @@ export default {
deep: true
}
},
+ beforeDestroy() {
+ this.socket.disconnect();
+ this.socket = null;
+ },
mounted() {
const BASE_URL = __APIURL__ || window.location.origin;
this.socket = io(`${BASE_URL}`);
@@ -110,10 +119,11 @@ export default {
if (success !== true) {
this.username = null;
- alert(reason)
+ this.validationError = reason;
} else {
this.usernameAllowed = true;
this.username = username;
+ this.validationError = null;
window.localStorage.setItem("username", username);
}
});
@@ -195,7 +205,8 @@ export default {