save username

This commit is contained in:
Alberto Xamin 2020-11-25 14:44:01 +01:00
parent e525b83cfb
commit 98ddaf519d
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2

View File

@ -100,6 +100,7 @@ export default {
setUsername(e){
if (this.username.trim().length > 0){
this.didSetUsername = true
localStorage.setItem('username', this.username)
this.$socket.emit('set_username', this.username)
e.preventDefault();
}
@ -124,7 +125,11 @@ export default {
init() {
location.reload();
},
}
},
mounted() {
if (localStorage.getItem('username'))
this.username = localStorage.getItem('username')
},
}
</script>