|
|
|
@ -111,14 +111,19 @@ const main = { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setState: (next) => { |
|
|
|
|
const prev = main.getState(); |
|
|
|
|
const state = main.getState(); |
|
|
|
|
const url = window.location.href.split('?')[0]; |
|
|
|
|
|
|
|
|
|
const eventKey = next.eventKey || prev.eventKey; |
|
|
|
|
const rounds = next.rounds || prev.rounds; |
|
|
|
|
const sort = next.sort || prev.sort || null; |
|
|
|
|
state.eventKey = next.eventKey || state.eventKey; |
|
|
|
|
state.rounds = next.rounds || state.rounds; |
|
|
|
|
state.sort = next.sort || state.sort || null; |
|
|
|
|
|
|
|
|
|
const params = []; |
|
|
|
|
for (key in state) { |
|
|
|
|
params.push(`${key}=${state[key]}`); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
history.pushState(null, null, `${url}?eventKey=${eventKey}&sort=${sort}&rounds=${rounds}`); |
|
|
|
|
history.pushState(null, null, `${url}?${params.join('&')}`); |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|