Permalink
Browse files

fixed some dumb shit

  • Loading branch information...
UNLRN committed Oct 10, 2017
1 parent f90137f commit 795c16e5a5b94c83eef5f62bbbd7e921fd8999a8
View
@@ -8,10 +8,10 @@ import {
import axios from 'axios';
import { Provider } from 'react-redux';
import Navbar from 'Shared';
import HomeContainer from 'HomePage';
import LoginContainer from 'LoginPage';
import DashboardContainer from 'DashboardPage';
import { Navbar } from 'Shared';
import { components } from 'HomePage';
import { LoginContainer } from 'LoginPage';
import { DashboardContainer } from 'DashboardPage';
import { configureStore } from 'store';
import initClient, { getSignInStatus } from 'utils/auth.js';
@@ -23,69 +23,16 @@ const style = {
color: '#FD4034'
};
class App extends Component {
constructor(props) {
super(props);
this.state = { user: null, isSignedIn: false, genres: [] };
this.setSignInStatus = this.setSignInStatus.bind(this);
this.setUser = this.setUser.bind(this);
this.configureAuth = this.configureAuth.bind(this);
// commenting out until function is implemented
// this.getGenres = this.getGenres.bind(this);
}
setSignInStatus(isSignedIn) {
this.setState({
isSignedIn
});
}
setUser(user) {
this.setState({
user
});
}
const store = configureStore();
componentDidMount() {
this.configureAuth();
}
configureAuth() {
const script = document.createElement('script');
script.src = 'https://apis.google.com/js/api.js';
script.onload = () => {
gapi.load('auth2', () => {
initClient(this.setSignInStatus, this.setUser);
});
};
document.body.appendChild(script);
}
class App extends Component {
render() {
const { isSignedIn, user } = this.state;
return (
<Provider store={configureStore}>
<Provider store={store}>
<Router>
<div>
<Route
path="/"
render={() => <Navbar isSignedIn={isSignedIn} user={user} />}
/>
<Route exact path="/" component={HomeContainer} />
<Route
path="/login"
render={() => {
return this.state.isSignedIn ? (
<Redirect to="/" />
) : (
<LoginContainer />
);
}}
/>
<Route path="/dashboard" component={DashboardContainer} />
<Route exact path="/" component={components.HomeContainer} />
</div>
</Router>
</Provider>
@@ -1 +1 @@
export { DashboardContainer } from './DashboardContainer'
import DashboardContainer from './DashboardContainer'
@@ -1 +1,7 @@
export { HomeContainer } from './HomeContainer'
import HomeContainer from './HomeContainer'
import Test from './Test'
export {
HomeContainer,
Test
}
View
@@ -1,9 +1,9 @@
import * as components from './components';
// import * as constants from './constants'
// import reducers from './reducers'
import * as constants from './constants'
import reducers from './reducers'
export default {
components
// constants,
// reducers
export {
components,
constants,
reducers,
};
@@ -1 +1 @@
export { LoginContainer } from './LoginContainer'
import LoginContainer from './LoginContainer'
@@ -1 +1 @@
export { Navbar } from './Navbar/Navbar'
import Navbar from './Navbar/Navbar'
View
@@ -8,5 +8,14 @@ export const configureStore = (initialState = {}) => {
initialState,
applyMiddleware(ReduxThunk)
);
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('./reducers', () => {
const nextRootReducer = require('./reducers');
store.replaceReducer(nextRootReducer);
});
}
return store;
};

0 comments on commit 795c16e

Please sign in to comment.