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

View file

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

View file

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