action types file
parent
a90bf1c3f3
commit
263ecdf14e
|
@ -0,0 +1 @@
|
||||||
|
export const CREATE_COURSE = "CREATE_COURSE";
|
|
@ -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 };
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue