initial state

master
Tudor Stanciu 2020-04-11 23:01:54 +03:00
parent 49fbd7be66
commit 210b0885a1
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import * as types from "../actions/actionTypes"; import * as types from "../actions/actionTypes";
import initialState from "./initialState";
export default function authorReducer(state = [], action) { export default function authorReducer(state = initialState.authors, action) {
switch (action.type) { switch (action.type) {
case types.LOAD_AUTHORS_SUCCESS: case types.LOAD_AUTHORS_SUCCESS:
return action.authors; return action.authors;

View File

@ -1,6 +1,7 @@
import * as types from "../actions/actionTypes"; import * as types from "../actions/actionTypes";
import initialState from "./initialState";
export default function courseReducer(state = [], action) { export default function courseReducer(state = initialState.courses, action) {
switch (action.type) { switch (action.type) {
case types.CREATE_COURSE: case types.CREATE_COURSE:
return [...state, { ...action.course }]; return [...state, { ...action.course }];

View File

@ -0,0 +1,4 @@
export default {
courses: [],
authors: []
};