Permalink
Browse files

actions and shit for movies

  • Loading branch information...
UNLRN committed Oct 11, 2017
1 parent dbba66e commit 8e0c657cf9389811173de0ff24fe65b6ef62b45a
@@ -0,0 +1,17 @@
import { NAME } from './constansts';
export const GET_MOVIES_START = `${NAME}/GET_MOVIES_START`
getMovies = (movies) => ({
type: GET_MOVIES_START,
payload: movies,
})
export const getMoviesThunk = (page) => {
return (dispatch) => {
fetch(api)
.then(data => {
dispatch(getMovies(data))
})
}
}
@@ -1,7 +1,5 @@
import HomeContainer from './HomeContainer'
import Test from './Test'
export {
HomeContainer,
Test
HomeContainer
}
@@ -0,0 +1 @@
export const NAME = 'home'
@@ -0,0 +1,10 @@
import * as ActionTypes from './actions';
export function movies(state = [], action) {
switch (action.type) {
case ActionTypes.GET_MOVIES:
return [...state, ...movies]
default:
return state
}
}

0 comments on commit 8e0c657

Please sign in to comment.