1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-30 00:44:20 +03:00

Adjust querystring updater

This commit is contained in:
Brent Jackson 2018-08-09 11:08:49 -07:00
parent 462ea34f40
commit 34f3793476

View File

@ -195,11 +195,13 @@ export class SlideDeck extends React.Component {
return
}
const { index, mode, step } = this.state
let query = '?'
if (mode !== modes.normal) {
query += querystring.stringify({
let query = ''
if (mode && mode !== modes.normal) {
query += '?' + querystring.stringify({
mode: (mode || '').toLowerCase()
})
} else if (mode === modes.normal) {
query += '/'
}
const step_ = step !== -1 ? ('.' + (step + 1)) : ''
history.pushState(null, null, query + '#' + index + step_)