Rename action.reload -> action.background
This commit is contained in:
parent
15d61a98e7
commit
73a3ee296b
3 changed files with 6 additions and 5 deletions
|
@ -190,8 +190,8 @@ export function logOut() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function switchAccount(accountId, reload = true) {
|
export function switchAccount(accountId, background = false) {
|
||||||
return { type: SWITCH_ACCOUNT, accountId, reload };
|
return { type: SWITCH_ACCOUNT, accountId, background };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchOwnAccounts() {
|
export function fetchOwnAccounts() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ProfileDropdown extends React.PureComponent {
|
||||||
|
|
||||||
handleMiddleClick = account => {
|
handleMiddleClick = account => {
|
||||||
return e => {
|
return e => {
|
||||||
this.props.dispatch(switchAccount(account.get('id'), false));
|
this.props.dispatch(switchAccount(account.get('id'), true));
|
||||||
window.open('/', '_blank', 'noopener,noreferrer');
|
window.open('/', '_blank', 'noopener,noreferrer');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
|
@ -154,7 +154,6 @@ const userSwitched = (oldState, state) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const maybeReload = (oldState, state, action) => {
|
const maybeReload = (oldState, state, action) => {
|
||||||
if (action.reload === false) return;
|
|
||||||
if (userSwitched(oldState, state)) {
|
if (userSwitched(oldState, state)) {
|
||||||
reload(state);
|
reload(state);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +166,9 @@ export default function auth(oldState = initialState, action) {
|
||||||
// Persist the state in localStorage
|
// Persist the state in localStorage
|
||||||
persistAuth(state);
|
persistAuth(state);
|
||||||
|
|
||||||
if (action.reload === false) {
|
// When middle-clicking a profile, we want to save the
|
||||||
|
// user in localStorage, but not update the reducer
|
||||||
|
if (action.background === true) {
|
||||||
return oldState;
|
return oldState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue