mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#195: use replace state, when navigating to permissions from oauth entry point
This commit is contained in:
@@ -23,7 +23,12 @@ export default class AuthFlow {
|
||||
}
|
||||
|
||||
setStore(store) {
|
||||
this.navigate = (route) => {
|
||||
/**
|
||||
* @param {string} route
|
||||
* @param {object} options
|
||||
* @param {object} options.replace
|
||||
*/
|
||||
this.navigate = (route, options = {}) => {
|
||||
if (this.getRequest().path !== route) {
|
||||
this.currentRequest = {
|
||||
path: route
|
||||
@@ -32,7 +37,7 @@ export default class AuthFlow {
|
||||
if (this.replace) {
|
||||
this.replace(route);
|
||||
}
|
||||
store.dispatch(routeActions.push(route)); // TODO: may be deleted?
|
||||
store.dispatch(routeActions[options.replace ? 'replace' : 'push'](route));
|
||||
}
|
||||
|
||||
this.replace = null;
|
||||
|
@@ -3,7 +3,11 @@ import CompleteState from './CompleteState';
|
||||
|
||||
export default class PermissionsState extends AbstractState {
|
||||
enter(context) {
|
||||
context.navigate('/oauth/permissions');
|
||||
context.navigate('/oauth/permissions', {
|
||||
// replacing oauth entry point if currently on it
|
||||
// to allow user easy go-back action to client's site
|
||||
replace: context.getRequest().path.includes('oauth2')
|
||||
});
|
||||
}
|
||||
|
||||
resolve(context) {
|
||||
|
Reference in New Issue
Block a user