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 { 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)
|
||||||
|
);
|
||||||
|
|
|
@ -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()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue