Initial setup history; Removing baseURL

This commit is contained in:
James Barnsley
2019-01-24 16:37:10 +13:00
parent 05d3d0c549
commit 5e6a9567e8
11 changed files with 18330 additions and 12628 deletions

View File

@ -123,7 +123,7 @@ class App extends React.Component{
// Allow 100ms for the action above to complete before we re-route
setTimeout(
() => {
this.props.history.push(global.baseURL);
this.props.history.push('/');
},
100
);

View File

@ -110,7 +110,7 @@ export default class GridItem extends React.Component{
if (this.props.link){
var link = this.props.link;
} else {
var link = global.baseURL+this.props.type+'/'+encodeURIComponent(item.uri);
var link = '/'+this.props.type+'/'+encodeURIComponent(item.uri);
}
return (

View File

@ -1,12 +1,8 @@
/**
* Base-level application wrapper
**/
import React, { PropTypes } from 'react';;
import ReactDOM from 'react-dom';;
import { Provider } from 'react-redux';
import { createStore } from 'redux';
//import { Router, Route, Link, IndexRoute, hashHistory } from 'react-router';
import { BrowserRouter, Route, IndexRoute } from "react-router-dom";
import store from './bootstrap.js';
@ -14,8 +10,6 @@ require('../scss/app.scss');
import App from './App';
global.baseURL = '/';
ReactDOM.render(
<Provider store={store}>
<BrowserRouter basename="/iris">

View File

@ -361,8 +361,6 @@ const CoreMiddleware = (function(){
break;
case 'LOAD_ALBUM':
console.log(action);
if (
!action.force_reload &&
store.getState().core.albums[action.uri] &&
@ -391,7 +389,6 @@ const CoreMiddleware = (function(){
break;
case 'LOAD_ARTIST':
if (
!action.force_reload &&
store.getState().core.artists[action.uri] &&
@ -421,7 +418,6 @@ const CoreMiddleware = (function(){
break;
case 'LOAD_PLAYLIST':
if (
!action.force_reload &&
store.getState().core.playlists[action.uri] &&

View File

@ -182,7 +182,7 @@ class Artist extends React.Component{
<div className="col col--w5"></div>
{artist.related_artists && artist.related_artists.length > 0 ? <div className="col col--w25 related-artists"><h4>Related artists</h4><div className="list-wrapper"><RelatedArtists artists={artist.related_artists.slice(0,6)} /></div><Link to={'/artist/'+artist.uri+'/related-artists'} scrollTo="sub-views-menu" className="button button--default">All related artists</Link></div> : null}
{artist.related_artists && artist.related_artists.length > 0 ? <div className="col col--w25 related-artists"><h4>Related artists</h4><div className="list-wrapper"><RelatedArtists artists={artist.related_artists.slice(0,6)} /></div><Link to={'/artist/'+encodeURIComponent(this.props.uri)+'/related-artists'} scrollTo="sub-views-menu" className="button button--default">All related artists</Link></div> : null}
<div className="cf"></div>

View File

@ -35,6 +35,7 @@ class InitialSetup extends React.Component{
handleSubmit(e){
e.preventDefault();
var self = this;
// Force local username change, even if remote connection absent/failed
@ -52,18 +53,19 @@ class InitialSetup extends React.Component{
this.setState({saving: true});
// Wait a jiffy to allow changes to apply to store
setTimeout(function(){
setTimeout(() => {
// We've changed a connection setting, so need to reload
if (self.state.host !== self.props.host || self.state.port !== self.props.port){
// We've changed a connection setting, so need to reload
if (self.state.host !== self.props.host || self.state.port !== self.props.port){
window.location = '/';
window.location = global.baseURL;
// Safe to just close modal
} else {
this.props.history.push(global.baseURL);
}
}, 200);
// Safe to just close modal
} else {
self.props.history.push('/');
}
},
200
);
return false;
}