File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import axios from 'axios/index';
22import Storage from '@/services/Storage' ;
33import { EventEmitter , TOKEN_EXPIRED_EVENT } from '@/services/EventEmitter' ;
44import { UNAUTHENTICATED } from '@/api/ErrorCodes' ;
5+ import { getSocketId } from '@/services/Pusher' ;
56
67class Api {
78 constructor ( apiUrl , authHeaderName = 'Authorization' , authHeaderPrefix = 'Bearer' ) {
@@ -16,6 +17,10 @@ class Api {
1617 config . headers [ authHeaderName ] = `${ authHeaderPrefix } ${ Storage . getToken ( ) } ` ;
1718 }
1819
20+ if ( getSocketId ( ) ) {
21+ config . headers [ 'X-Socket-ID' ] = getSocketId ( ) ;
22+ }
23+
1924 return config ;
2025 } ,
2126 error => Promise . reject ( error )
Original file line number Diff line number Diff line change @@ -22,3 +22,7 @@ if (Storage.hasToken()) {
2222
2323
2424export const pusher = new Pusher ( process . env . VUE_APP_PUSHER_APP_KEY , config ) ;
25+
26+ export const getSocketId = ( ) => {
27+ return pusher . connection . socket_id ;
28+ } ;
You can’t perform that action at this time.
0 commit comments