schedule.actions.ts 834 Bytes
Newer Older
1
import CourseSection from '../../util/CourseSection';
David Haynes's avatar
David Haynes committed
2
import { ADD_COURSE_SECTION, REMOVE_COURSE_SECTION } from './schedule.action-types';
Andrew Hrdy's avatar
Andrew Hrdy committed
3
4

export interface ScheduleAction {
5
    type: string; // What action is to be performed
David Haynes's avatar
David Haynes committed
6
    courseSection: CourseSection; // The section that is being added/removed
Andrew Hrdy's avatar
Andrew Hrdy committed
7
8
}

9
10
11
12
/**
 * Add a section to the Schedule
 * @param section The section that is to be added
 */
David Haynes's avatar
David Haynes committed
13
14
15
export const addCourseSection = (courseSectionToAdd: CourseSection): ScheduleAction => ({
    type: ADD_COURSE_SECTION,
    courseSection: courseSectionToAdd,
16
});
Andrew Hrdy's avatar
Andrew Hrdy committed
17

18
19
20
21
/**
 * Remove a section from the Schedule
 * @param section The section that is to be removed
 */
David Haynes's avatar
David Haynes committed
22
23
24
export const removeCourseSection = (courseSectionToRemove: CourseSection): ScheduleAction => ({
    type: REMOVE_COURSE_SECTION,
    courseSection: courseSectionToRemove,
25
});