File tree Expand file tree Collapse file tree 10 files changed +54
-42
lines changed
Expand file tree Collapse file tree 10 files changed +54
-42
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,5 @@ node_modules
2828
2929# Bower
3030bower_components /
31+
32+ .idea /
Original file line number Diff line number Diff line change 1010 "default_popup" : " index.html"
1111 },
1212 "permissions" : [
13- " activeTab"
13+ " activeTab" ,
14+ " storage"
1415 ]
1516}
Original file line number Diff line number Diff line change 6767 "react" : " ^15.0.0" ,
6868 "react-dom" : " ^15.0.0" ,
6969 "react-redux" : " ^4.4.5" ,
70- "redux" : " ^3.5.2"
70+ "redux" : " ^3.5.2" ,
71+ "redux-logger" : " ^2.6.1" ,
72+ "redux-thunk" : " ^2.1.0"
7173 }
7274}
Original file line number Diff line number Diff line change @@ -4,25 +4,10 @@ require('styles/App.css');
44import React , { Component } from 'react' ;
55
66class Main extends Component {
7- constructor ( props ) {
8- super ( props ) ;
9- this . state = {
10- status : false
11- }
12- }
13-
14- componentDidMount ( ) {
15- this . setState ( {
16- status : false
17- } ) ;
18- }
19-
207 render ( ) {
21- let status = this . state ;
22-
238 return (
249 < div className = "index" >
25- component did mount? { status }
10+ main content
2611 </ div >
2712 ) ;
2813 }
Original file line number Diff line number Diff line change 11import React , { Component } from 'react' ;
22import { connect } from 'react-redux' ;
3- import Main from '../components/Main ' ;
3+ import Main from '../components/main ' ;
44
55class App extends Component {
66 render ( ) {
@@ -9,8 +9,10 @@ class App extends Component {
99}
1010
1111function mapStateToProps ( state ) {
12- const props = { } ;
13- return props ;
12+ let { auth } = state ;
13+ return {
14+ auth : auth
15+ } ;
1416}
1517
1618export default connect ( mapStateToProps ) ( App ) ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { render } from 'react-dom' ;
33import { Provider } from 'react-redux' ;
4- import configureStore from './stores' ;
5- import App from './containers/App ' ;
4+ import configureStore from './stores/configureStore ' ;
5+ import App from './containers/app ' ;
66
77const store = configureStore ( ) ;
88
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const initialState = {
1111 isAuthenticated : loggedIn ( ) ,
1212 userId : getUserId ( ) ,
1313 username : getUserName ( )
14- }
14+ } ;
1515
1616function auth ( state = initialState , action ) {
1717 switch ( action . type ) {
Original file line number Diff line number Diff line change 11import { combineReducers } from 'redux' ;
2+ import Auth from './auth' ;
23
3- const reducers = { } ;
4- module . exports = combineReducers ( reducers ) ;
4+ export default combineReducers ( {
5+ Auth
6+ } ) ;
Original file line number Diff line number Diff line change 1+ import { createStore , combineReducers , applyMiddleware } from 'redux' ;
2+ import thunk from 'redux-thunk' ;
3+ import createLogger from 'redux-logger' ;
4+
5+ // reducers combined
6+ import reducers from '../reducers/index' ;
7+
8+ let logger , store ;
9+
10+ export default function configureStore ( initialState ) {
11+ if ( process . env . NODE_ENV !== 'production' ) {
12+ logger = createLogger ( ) ;
13+
14+ store = createStore ( reducers , initialState , applyMiddleware (
15+ thunk ,
16+ logger
17+ ) ) ;
18+
19+ } else {
20+ store = createStore ( reducers , initialState , applyMiddleware (
21+ thunk
22+ ) ) ;
23+ }
24+
25+ if ( module . hot ) {
26+ // Enable Webpack hot module replacement for reducers
27+ module . hot . accept ( '../reducers' , ( ) => {
28+ const nextReducer = require ( '../reducers' ) ;
29+ store . replaceReducer ( nextReducer )
30+ } )
31+ }
32+
33+ return store
34+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments