Remove the access token from Redux & context (#30275)
This commit is contained in:
parent
2c75cf8599
commit
2c5ab8f647
35 changed files with 225 additions and 226 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
import WebSocketClient from '@gamestdio/websocket';
|
||||
|
||||
import { getAccessToken } from './initial_state';
|
||||
|
||||
/**
|
||||
* @type {WebSocketClient | undefined}
|
||||
*/
|
||||
|
@ -145,9 +147,11 @@ const channelNameWithInlineParams = (channelName, params) => {
|
|||
// @ts-expect-error
|
||||
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
||||
const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
|
||||
const accessToken = getState().getIn(['meta', 'access_token']);
|
||||
const accessToken = getAccessToken();
|
||||
const { onConnect, onReceive, onDisconnect } = callbacks(dispatch, getState);
|
||||
|
||||
if(!accessToken) throw new Error("Trying to connect to the streaming server but no access token is available.");
|
||||
|
||||
// If we cannot use a websockets connection, we must fall back
|
||||
// to using individual connections for each channel
|
||||
if (!streamingAPIBaseURL.startsWith('ws')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue