Use replace in updateSelection
This commit is contained in:
parent
a4d40bef39
commit
ff7c563b61
File diff suppressed because one or more lines are too long
@ -1,11 +1,12 @@
|
||||
import * as actions from '../actions';
|
||||
import { push, replace } from '../util/router';
|
||||
|
||||
export function select(server, name) {
|
||||
export function select(server, name, doReplace) {
|
||||
const navigate = doReplace ? replace : push;
|
||||
if (name) {
|
||||
return push(`/${server}/${encodeURIComponent(name)}`);
|
||||
return navigate(`/${server}/${encodeURIComponent(name)}`);
|
||||
}
|
||||
return push(`/${server}`);
|
||||
return navigate(`/${server}`);
|
||||
}
|
||||
|
||||
export function updateSelection() {
|
||||
@ -19,11 +20,11 @@ export function updateSelection() {
|
||||
dispatch(replace('/connect'));
|
||||
} else if (history.size > 0) {
|
||||
const tab = history.last();
|
||||
dispatch(select(tab.server, tab.name));
|
||||
dispatch(select(tab.server, tab.name, true));
|
||||
} else if (servers.has(server)) {
|
||||
dispatch(select(server));
|
||||
dispatch(select(server, null, true));
|
||||
} else {
|
||||
dispatch(replace('/'));
|
||||
dispatch(select(servers.keySeq().first(), null, true));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user