only set x-lbry-auth-token once user is signed in

This commit is contained in:
Sean Yesmunt 2020-06-02 15:01:30 -04:00
parent 48eac1188f
commit 16fcc4c932
3 changed files with 5 additions and 11 deletions

View file

@ -44,9 +44,7 @@ class UserVerify extends React.PureComponent<Props> {
rewards_program: (
<Button button="link" label={__('Rewards Program')} href="https://lbry.com/faq/rewards" />
),
Refresh: (
<Button icon={ICONS.REFRESH} onClick={() => fetchUser()} button="link" label={__('Refresh')} />
),
Refresh: <Button onClick={() => fetchUser()} button="link" label={__('Refresh')} />,
Skip: <Button {...skipButtonProps} button="link" label={__('Skip')} />,
}}
>

View file

@ -143,13 +143,6 @@ Lbryio.setOverride(
() =>
new Promise(resolve => {
const authTokenToReturn = authToken || getAuthToken();
// @if TARGET='web'
if (authTokenToReturn !== null) {
Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, authTokenToReturn);
}
// @endif
resolve(authTokenToReturn);
})
);

View file

@ -46,7 +46,8 @@ import {
import { doAuthenticate, doGetSync, doClaimRewardType, rewards as REWARDS } from 'lbryinc';
import { lbrySettings as config, version as appVersion } from 'package.json';
import analytics, { SHARE_INTERNAL } from 'analytics';
import { doSignOutCleanup, deleteSavedPassword, getSavedPassword } from 'util/saved-passwords';
import { doSignOutCleanup, deleteSavedPassword, getSavedPassword, getAuthToken } from 'util/saved-passwords';
import { X_LBRY_AUTH_TOKEN } from 'constants/token';
// @if TARGET='app'
const { autoUpdater } = remote.require('electron-updater');
@ -494,6 +495,8 @@ export function doAnaltyicsPurchaseEvent(fileInfo) {
export function doSignIn() {
return (dispatch, getState) => {
// @if TARGET='web'
const authToken = getAuthToken();
Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, authToken);
dispatch(doBalanceSubscribe());
dispatch(doFetchChannelListMine());
// @endif