Created
February 14, 2016 00:00
-
-
Save scott-riley/4b960201c97e049956fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// actions/index.js | |
/* Team actions */ | |
export function fetchTeams() { | |
const request = axios.get(`${ROOT_URL}/teams${ACCESS_TOKEN}`); | |
return { | |
type: FETCH_TEAMS, | |
payload: request | |
}; | |
} | |
// reducer_teams.js | |
import {FETCH_TEAMS} from 'actions/index'; | |
import {INITIAL_STATE} from './index'; // these both import fine | |
export default function(state = INITIAL_STATE, action) { | |
switch(action.type) { | |
case FETCH_TEAMS: | |
console.log(action.payload.data.data; // this console.logs at the right time so I know FETCH_TEAMS is being called when it should | |
return { | |
...state, | |
teams: action.payload.data.data, | |
} | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment