Permalink
Browse files

Fix calling Websockets when the user is not logged in

  • Loading branch information...
yabirgb committed Feb 1, 2019
1 parent f63ebf1 commit 21d5db643ae653a94dcab8352a845c57200adb93
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/components/layouts/Navigation.vue
@@ -69,13 +69,11 @@ export default {
},
mounted(){
if(isLoggedIn()){
this.stream();
}
},
methods:{
isLoggedIn() {
return this.user !== null && this.user !== undefined
return (this.user !== null && this.user !== undefined) || false
},
logout(){
logout();
@@ -86,14 +84,16 @@ export default {
},
stream(){
var url = process.env.VUE_APP_CLIENT_DOMAIN
var source = new SSE(url + urls.streamingHome, {headers: {'Authorization': `${this.user.token}`}});
let self = this;
source.addEventListener('notification', function(e) {
self.notifications += 1;
console.log(e)
});
source.stream();
if(this.isLoggedIn()){
var url = process.env.VUE_APP_CLIENT_DOMAIN
var source = new SSE(url + urls.streamingHome, {headers: {'Authorization': `${this.user.token}`}});
let self = this;
source.addEventListener('notification', function(e) {
self.notifications += 1;
console.log(e)
});
source.stream();
}
}
}

0 comments on commit 21d5db6

Please sign in to comment.