diff options
-rw-r--r-- | src/store/modules/Authentication/AuthenticanStore.js | 3 | ||||
-rw-r--r-- | src/store/plugins/WebSocketPlugin.js | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js index d64c7308..7a0c5ba3 100644 --- a/src/store/modules/Authentication/AuthenticanStore.js +++ b/src/store/modules/Authentication/AuthenticanStore.js @@ -10,7 +10,8 @@ const AuthenticationStore = { }, getters: { authError: state => state.authError, - isLoggedIn: state => !!state.cookie + isLoggedIn: state => !!state.cookie, + token: state => state.cookie }, mutations: { authSuccess(state) { diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js index 409b1686..965c32c9 100644 --- a/src/store/plugins/WebSocketPlugin.js +++ b/src/store/plugins/WebSocketPlugin.js @@ -18,7 +18,8 @@ const WebSocketPlugin = store => { }; const initWebSocket = () => { - ws = new WebSocket(`wss://${window.location.host}/subscribe`); + const token = store.getters['authentication/token']; + ws = new WebSocket(`wss://${window.location.host}/subscribe`, [token]); ws.onopen = () => { ws.send(JSON.stringify(data)); }; |