action types file

master
Tudor Stanciu 2020-04-11 19:42:29 +03:00
parent a90bf1c3f3
commit 263ecdf14e
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1 @@
export const CREATE_COURSE = "CREATE_COURSE";

View File

@ -1,3 +1,5 @@
import * as types from "./actionTypes";
export function createCourse(course) { export function createCourse(course) {
return { type: "CREATE_COURSE", course }; return { type: types.CREATE_COURSE, course };
} }

View File

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