File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import axios from 'axios' ;
22import { FETCH_USER } from './types' ;
33
4- const fetchUser = ( ) => {
4+ export const fetchUser = ( ) => {
55 return function ( dispatch ) {
66 axios
77 . get ( '/api/current_user' )
Original file line number Diff line number Diff line change 11import React , { Component } from 'react' ;
22import { BrowserRouter , Route } from 'react-router-dom' ;
3+ import { connect } from 'react-redux' ;
4+ import * as actions from '../actions' ;
35
46import Header from './Header' ;
57const Dashboard = ( ) => < h2 > Dashboard</ h2 > ;
68const SurveyNew = ( ) => < h2 > SurveyNew</ h2 > ;
79const Landing = ( ) => < h2 > Landing</ h2 > ;
810
911class App extends Component {
12+ componentDidMount ( ) {
13+ this . props . fetchUser ( ) ;
14+ }
15+
1016 render ( ) {
1117 return (
1218 < div className = "container" >
@@ -23,4 +29,4 @@ class App extends Component {
2329 }
2430}
2531
26- export default App ;
32+ export default connect ( null , actions ) ( App ) ;
Original file line number Diff line number Diff line change 11export default function ( state = { } , action ) {
2+ console . log ( action ) ;
23 switch ( action . type ) {
34 default :
45 return state ;
You can’t perform that action at this time.
0 commit comments