mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#389: do not allow return to profile during re-login (temporary solution)
This commit is contained in:
@@ -7,6 +7,7 @@ import loader from 'services/loader';
|
||||
import history from 'services/history';
|
||||
import { updateUser, acceptRules as userAcceptRules } from 'components/user/actions';
|
||||
import { authenticate, logoutAll } from 'components/accounts/actions';
|
||||
import { getActiveAccount } from 'components/accounts/reducer';
|
||||
import authentication from 'services/api/authentication';
|
||||
import oauth from 'services/api/oauth';
|
||||
import signup from 'services/api/signup';
|
||||
@@ -436,9 +437,20 @@ export function resetOAuth() {
|
||||
* @return {function}
|
||||
*/
|
||||
export function resetAuth() {
|
||||
return (dispatch: (Function | Object) => void) => {
|
||||
return (dispatch: (Function | Object) => void, getSate: () => Object): Promise<void> => {
|
||||
dispatch(setLogin(null));
|
||||
dispatch(resetOAuth());
|
||||
// ensure current account is valid
|
||||
const activeAccount = getActiveAccount(getSate());
|
||||
|
||||
if (activeAccount) {
|
||||
return Promise.resolve(dispatch(authenticate(activeAccount)))
|
||||
.catch(() => {
|
||||
// its okay. user will be redirected to an appropriate place
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user