Remove 'store.user.accessToken' now that we've confirmed nobody uses it.

This commit is contained in:
infinite-persistence 2022-01-19 21:27:22 +08:00 committed by Thomas Zarebczan
parent 0c9859e3ac
commit a8a666383a
6 changed files with 2 additions and 31 deletions

View file

@ -1,7 +1,7 @@
import { hot } from 'react-hot-loader/root'; import { hot } from 'react-hot-loader/root';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectGetSyncErrorMessage, selectSyncFatalError, selectSyncIsLocked } from 'redux/selectors/sync'; import { selectGetSyncErrorMessage, selectSyncFatalError, selectSyncIsLocked } from 'redux/selectors/sync';
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user'; import { doUserSetReferrer } from 'redux/actions/user';
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectUnclaimedRewards } from 'redux/selectors/rewards'; import { selectUnclaimedRewards } from 'redux/selectors/rewards';
import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims'; import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from 'redux/actions/claims';
@ -43,7 +43,6 @@ const select = (state) => ({
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()), fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()), fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
setLanguage: (language) => dispatch(doSetLanguage(language)), setLanguage: (language) => dispatch(doSetLanguage(language)),

View file

@ -60,7 +60,6 @@ type Props = {
user: ?{ id: string, has_verified_email: boolean, is_reward_approved: boolean }, user: ?{ id: string, has_verified_email: boolean, is_reward_approved: boolean },
location: { pathname: string, hash: string, search: string }, location: { pathname: string, hash: string, search: string },
history: { push: (string) => void }, history: { push: (string) => void },
fetchAccessToken: () => void,
fetchChannelListMine: () => void, fetchChannelListMine: () => void,
fetchCollectionListMine: () => void, fetchCollectionListMine: () => void,
signIn: () => void, signIn: () => void,
@ -93,7 +92,6 @@ function App(props: Props) {
const { const {
theme, theme,
user, user,
fetchAccessToken,
fetchChannelListMine, fetchChannelListMine,
fetchCollectionListMine, fetchCollectionListMine,
signIn, signIn,
@ -285,13 +283,11 @@ function App(props: Props) {
ReactModal.setAppElement(wrapperElement); ReactModal.setAppElement(wrapperElement);
} }
fetchAccessToken();
// @if TARGET='app' // @if TARGET='app'
fetchChannelListMine(); // This is fetched after a user is signed in on web fetchChannelListMine(); // This is fetched after a user is signed in on web
fetchCollectionListMine(); fetchCollectionListMine();
// @endif // @endif
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchCollectionListMine]); }, [appRef, fetchChannelListMine, fetchCollectionListMine]);
useEffect(() => { useEffect(() => {
// $FlowFixMe // $FlowFixMe

View file

@ -288,7 +288,6 @@ export const USER_INVITE_STATUS_FETCH_FAILURE = 'USER_INVITE_STATUS_FETCH_FAILUR
export const USER_INVITE_NEW_STARTED = 'USER_INVITE_NEW_STARTED'; export const USER_INVITE_NEW_STARTED = 'USER_INVITE_NEW_STARTED';
export const USER_INVITE_NEW_SUCCESS = 'USER_INVITE_NEW_SUCCESS'; export const USER_INVITE_NEW_SUCCESS = 'USER_INVITE_NEW_SUCCESS';
export const USER_INVITE_NEW_FAILURE = 'USER_INVITE_NEW_FAILURE'; export const USER_INVITE_NEW_FAILURE = 'USER_INVITE_NEW_FAILURE';
export const FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
export const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED'; export const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
export const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE'; export const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
export const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS'; export const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS';

View file

@ -573,17 +573,6 @@ export function doUserEmailVerify(verificationToken, recaptcha) {
}; };
} }
export function doFetchAccessToken() {
return (dispatch) => {
const success = (token) =>
dispatch({
type: ACTIONS.FETCH_ACCESS_TOKEN_SUCCESS,
data: { token },
});
Lbryio.getAuthToken().then(success);
};
}
export function doUserIdentityVerify(stripeToken) { export function doUserIdentityVerify(stripeToken) {
return (dispatch) => { return (dispatch) => {
dispatch({ dispatch({

View file

@ -25,7 +25,6 @@ const defaultState = {
referralLink: undefined, referralLink: undefined,
referralCode: undefined, referralCode: undefined,
user: undefined, user: undefined,
accessToken: undefined,
youtubeChannelImportPending: false, youtubeChannelImportPending: false,
youtubeChannelImportErrorMessage: '', youtubeChannelImportErrorMessage: '',
referrerSetIsPending: false, referrerSetIsPending: false,
@ -36,14 +35,12 @@ reducers[ACTIONS.AUTHENTICATION_STARTED] = (state) =>
Object.assign({}, state, { Object.assign({}, state, {
authenticationIsPending: true, authenticationIsPending: true,
userIsPending: true, userIsPending: true,
accessToken: defaultState.accessToken,
}); });
reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) => reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) =>
Object.assign({}, state, { Object.assign({}, state, {
authenticationIsPending: false, authenticationIsPending: false,
userIsPending: false, userIsPending: false,
accessToken: action.data.accessToken,
user: action.data.user, user: action.data.user,
}); });
@ -221,14 +218,6 @@ reducers[ACTIONS.USER_IDENTITY_VERIFY_FAILURE] = (state, action) =>
identityVerifyErrorMessage: action.data.error, identityVerifyErrorMessage: action.data.error,
}); });
reducers[ACTIONS.FETCH_ACCESS_TOKEN_SUCCESS] = (state, action) => {
const { token } = action.data;
return Object.assign({}, state, {
accessToken: token,
});
};
reducers[ACTIONS.USER_INVITE_STATUS_FETCH_STARTED] = (state) => reducers[ACTIONS.USER_INVITE_STATUS_FETCH_STARTED] = (state) =>
Object.assign({}, state, { Object.assign({}, state, {
inviteStatusIsPending: true, inviteStatusIsPending: true,

View file

@ -73,7 +73,6 @@ export const selectUserIsVerificationCandidate = createSelector(
(user) => user && (!user.has_verified_email || !user.is_identity_verified) (user) => user && (!user.has_verified_email || !user.is_identity_verified)
); );
export const selectAccessToken = (state) => selectState(state).accessToken;
export const selectUserInviteStatusIsPending = (state) => selectState(state).inviteStatusIsPending; export const selectUserInviteStatusIsPending = (state) => selectState(state).inviteStatusIsPending;
export const selectUserInvitesRemaining = (state) => selectState(state).invitesRemaining; export const selectUserInvitesRemaining = (state) => selectState(state).invitesRemaining;
export const selectUserInvitees = (state) => selectState(state).invitees; export const selectUserInvitees = (state) => selectState(state).invitees;