WikiEducationFoundation/WikiEduDashboard

View on GitHub
app/assets/javascripts/reducers/user_courses.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { RECEIVE_USER_COURSES } from '../constants';

const initialState = {
  userCourses: [],
  loading: true
};

export default function userCourses(state = initialState, action) {
  switch (action.type) {
    case RECEIVE_USER_COURSES: {
      return {
        userCourses: action.payload.data.courses,
        loading: false
      };
    }
    default:
      return state;
  }
}