From 034cef3ed7059a6785e16c60c81870b1a75f278e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 24 Oct 2019 12:06:38 -0400 Subject: [PATCH] set lbry.tv header as soon as we get the auth_token cookie --- src/ui/index.jsx | 4 +++- src/ui/redux/actions/app.js | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ui/index.jsx b/src/ui/index.jsx index 5a9bd6920..2b2b3b8fa 100644 --- a/src/ui/index.jsx +++ b/src/ui/index.jsx @@ -12,7 +12,7 @@ import React, { Fragment, useState, useEffect } from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate, doOpenModal, doHideModal } from 'redux/actions/app'; -import { doToast, isURIValid, setSearchApi } from 'lbry-redux'; +import { Lbry, doToast, isURIValid, setSearchApi } from 'lbry-redux'; import { doUpdateIsNightAsync } from 'redux/actions/settings'; import { doAuthenticate, @@ -30,6 +30,7 @@ import { formatLbryUriForWeb } from 'util/uri'; import { PersistGate } from 'redux-persist/integration/react'; import analytics from 'analytics'; import { getAuthToken, setAuthToken } from 'util/saved-passwords'; +import { X_LBRY_AUTH_TOKEN } from 'constants/token'; // Import our app styles // If a style is not necessary for the initial page load, it should be removed from `all.scss` @@ -109,6 +110,7 @@ Lbryio.setOverride( // @endif // @if TARGET='web' const authToken = getAuthToken(); + Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, authToken); resolve(authToken); // @endif } diff --git a/src/ui/redux/actions/app.js b/src/ui/redux/actions/app.js index 3333fd35a..74e1d56be 100644 --- a/src/ui/redux/actions/app.js +++ b/src/ui/redux/actions/app.js @@ -7,7 +7,6 @@ import path from 'path'; import * as ACTIONS from 'constants/action_types'; import * as MODALS from 'constants/modal_types'; import * as PAGES from 'constants/pages'; -import { X_LBRY_AUTH_TOKEN } from 'constants/token'; import { Lbry, doBalanceSubscribe, @@ -38,7 +37,7 @@ import { doAuthenticate, doGetSync } from 'lbryinc'; import { lbrySettings as config, version as appVersion } from 'package.json'; import { push } from 'connected-react-router'; import analytics from 'analytics'; -import { deleteAuthToken, deleteSavedPassword, getSavedPassword, getAuthToken } from 'util/saved-passwords'; +import { deleteAuthToken, deleteSavedPassword, getSavedPassword } from 'util/saved-passwords'; // @if TARGET='app' const { autoUpdater } = remote.require('electron-updater'); @@ -437,9 +436,6 @@ export function doAnalyticsView(uri, timeToStart) { export function doSignIn() { return (dispatch, getState) => { // @if TARGET='web' - const authToken = getAuthToken(); - Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, authToken); - dispatch(doBalanceSubscribe()); dispatch(doFetchChannelListMine()); // @endif