fix: auth redirects
This commit is contained in:
parent
11cd81ebd8
commit
08b30fe0f2
3 changed files with 18 additions and 9 deletions
|
@ -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)
|
||||
);
|
||||
|
|
|
@ -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()),
|
||||
});
|
||||
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue