fix: auth redirects

This commit is contained in:
Sean Yesmunt 2019-04-04 18:23:12 -04:00
parent 11cd81ebd8
commit 08b30fe0f2
3 changed files with 18 additions and 9 deletions

View file

@ -1,16 +1,24 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app'; import { doHideModal } from 'redux/actions/app';
import { withRouter } from 'react-router-dom';
import ModalRewardApprovalRequired from './view'; import ModalRewardApprovalRequired from './view';
const perform = dispatch => ({ const perform = (dispatch, ownProps) => ({
doAuth: () => { doAuth: () => {
const {
location: { pathname },
history,
} = ownProps;
const currentPath = pathname.split('/$/')[1];
dispatch(doHideModal()); dispatch(doHideModal());
// dispatch(doAuthNavigate()); history.push(`/$/auth?redirect=${currentPath}`);
}, },
closeModal: () => dispatch(doHideModal()), closeModal: () => dispatch(doHideModal()),
}); });
export default connect( export default withRouter(
null, connect(
perform null,
)(ModalRewardApprovalRequired); perform
)(ModalRewardApprovalRequired)
);

View file

@ -9,8 +9,8 @@ const select = state => ({
deamonSettings: selectDaemonSettings(state), deamonSettings: selectDaemonSettings(state),
}); });
const perform = dispatch => ({ const perform = (dispatch, ownProps) => ({
// doAuth: () => dispatch(doAuthNavigate('/help')), doAuth: () => ownProps.history.push('/$/auth?redirect=help'),
fetchAccessToken: () => dispatch(doFetchAccessToken()), fetchAccessToken: () => dispatch(doFetchAccessToken()),
}); });

View file

@ -23,6 +23,7 @@ import {
} from 'redux/selectors/app'; } from 'redux/selectors/app';
import { doAuthenticate } from 'lbryinc'; import { doAuthenticate } from 'lbryinc';
import { lbrySettings as config, version as appVersion } from 'package.json'; import { lbrySettings as config, version as appVersion } from 'package.json';
import { push } from 'connected-react-router';
// @if TARGET='app' // @if TARGET='app'
const { autoUpdater } = remote.require('electron-updater'); const { autoUpdater } = remote.require('electron-updater');
@ -388,7 +389,7 @@ export function doConditionalAuthNavigate(newSession) {
const modal = selectModal(state); const modal = selectModal(state);
if (newSession || (modal && modal.id !== MODALS.EMAIL_COLLECTION)) { if (newSession || (modal && modal.id !== MODALS.EMAIL_COLLECTION)) {
// dispatch(doAuthNavigate()); dispatch(push('/$/auth'));
} }
}; };
} }