A couple of minor history fixes

This commit is contained in:
6ea86b96 2017-05-07 00:57:34 +07:00
parent d2c97d3460
commit 3085b2d362
No known key found for this signature in database
GPG key ID: B282D183E4931E8F
2 changed files with 9 additions and 8 deletions

View file

@ -22,19 +22,18 @@ const queryStringFromParams = (params) => {
.join('&')
}
export function doNavigate(path, params) {
export function doNavigate(path, params = {}) {
return function(dispatch, getState) {
const state = getState()
const pageTitle = selectPageTitle(state)
let url = path
if (params)
url = `${url}?${queryStringFromParams(params)}`
history.pushState(params, pageTitle, url)
window.document.title = pageTitle
dispatch(doChangePath(url))
const state = getState()
const pageTitle = selectPageTitle(state)
history.pushState(params, pageTitle, url)
window.document.title = pageTitle
}
}
@ -46,6 +45,7 @@ export function doChangePath(path) {
path,
}
})
}
}

View file

@ -1,4 +1,5 @@
import {createSelector} from 'reselect'
import lbryuri from 'lbryuri'
import {
selectIsSearching,
selectSearchActivated,
@ -62,7 +63,7 @@ export const selectPageTitle = createSelector(
case 'rewards':
return page.charAt(0).toUpperCase() + page.slice(1)
case 'show':
return lbryuri.normalize(page)
return lbryuri.normalize(uri)
case 'downloaded':
return 'Downloads & Purchases'
case 'published':