Reverting to hashHistory for cross-platform URL stability; Setting baseURL in index.js

This commit is contained in:
James Barnsley
2016-12-21 21:49:20 +13:00
parent cf8521e421
commit de0dd770d5
7 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'
import { Link, browserHistory } from 'react-router'
import { Router, Link, hashHistory } from 'react-router'
import FontAwesome from 'react-fontawesome'
import Thumbnail from './Thumbnail'
@ -14,7 +14,7 @@ export default class GridItem extends React.Component{
handleClick(e){
if( e.target.tagName.toLowerCase() !== 'a' ){
browserHistory.push( this.props.link );
hashHistory.push(this.props.link)
}
}

View File

@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'
import { Link, browserHistory } from 'react-router'
import { Link, hashHistory } from 'react-router'
import FontAwesome from 'react-fontawesome'
import ArtistSentence from './ArtistSentence'
@ -17,7 +17,7 @@ export default class List extends React.Component{
// make sure we haven't clicked a nested link (ie Artist name)
if( e.target.tagName.toLowerCase() !== 'a' ){
browserHistory.push( this.props.link_prefix + encodeURIComponent(uri) );
hashHistory.push( this.props.link_prefix + encodeURIComponent(uri) );
}
}

View File

@ -6,7 +6,7 @@ import React, { PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import { Router, Route, Link, IndexRoute, browserHistory } from 'react-router'
import { Router, Route, Link, IndexRoute, hashHistory } from 'react-router'
import store from './bootstrap.js'
@ -37,11 +37,11 @@ import LibraryLocalArtists from './views/library/LibraryLocalArtists'
import LibraryLocalAlbums from './views/library/LibraryLocalAlbums'
import LibraryLocalDirectory from './views/library/LibraryLocalDirectory'
global.baseURL = '/iris/'
global.baseURL = '/'
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Router history={hashHistory}>
<Route path={global.baseURL} component={App}>
<IndexRoute component={Queue} />

View File

@ -19,17 +19,17 @@ export default class LibraryLocal extends React.Component{
{
name: 'Artists',
link: global.baseURL+'library/local/artists',
icons: ['/assets/backgrounds/category-artists.jpg']
icons: ['assets/backgrounds/category-artists.jpg']
},
{
name: 'Albums',
link: global.baseURL+'library/local/albums',
icons: ['/assets/backgrounds/category-albums.jpg']
icons: ['assets/backgrounds/category-albums.jpg']
},
{
name: 'Folders',
link: global.baseURL+'library/local/directory/local:directory',
icons: ['/assets/backgrounds/category-folders.jpg']
icons: ['assets/backgrounds/category-folders.jpg']
}
]