kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Rename action.reload -> action.background
rodzic
15d61a98e7
commit
73a3ee296b
|
@ -190,8 +190,8 @@ export function logOut() {
|
|||
};
|
||||
}
|
||||
|
||||
export function switchAccount(accountId, reload = true) {
|
||||
return { type: SWITCH_ACCOUNT, accountId, reload };
|
||||
export function switchAccount(accountId, background = false) {
|
||||
return { type: SWITCH_ACCOUNT, accountId, background };
|
||||
}
|
||||
|
||||
export function fetchOwnAccounts() {
|
||||
|
|
|
@ -66,7 +66,7 @@ class ProfileDropdown extends React.PureComponent {
|
|||
|
||||
handleMiddleClick = account => {
|
||||
return e => {
|
||||
this.props.dispatch(switchAccount(account.get('id'), false));
|
||||
this.props.dispatch(switchAccount(account.get('id'), true));
|
||||
window.open('/', '_blank', 'noopener,noreferrer');
|
||||
e.preventDefault();
|
||||
};
|
||||
|
|
|
@ -154,7 +154,6 @@ const userSwitched = (oldState, state) => {
|
|||
};
|
||||
|
||||
const maybeReload = (oldState, state, action) => {
|
||||
if (action.reload === false) return;
|
||||
if (userSwitched(oldState, state)) {
|
||||
reload(state);
|
||||
}
|
||||
|
@ -167,7 +166,9 @@ export default function auth(oldState = initialState, action) {
|
|||
// Persist the state in localStorage
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue