Fix: Lang routes persist between sessions

This commit is contained in:
Stuart Taylor
2016-11-25 00:59:51 +00:00
parent 9eb2f2e488
commit 496c648f46
2 changed files with 6 additions and 3 deletions

View File

@@ -23,9 +23,9 @@ function getLangFromLocation(location) {
return getLangFromPath(location.pathname);
}
export default function useLangRoutes(createHistory) {
export default function useLangRoutes(createHistory, primaryLang) {
return (options = {}) => {
let lang = 'en';
let lang = primaryLang || 'en';
const history = createHistory(options);
const unsubscribeFromHistory = history.listen(nextLocation => {
lang = getLangFromLocation(nextLocation);