-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from sparcs-kaist/migration@reducers/timetable
Migrate redux reducers about timetable
- Loading branch information
Showing
9 changed files
with
219 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { RESET, SET_SEMESTER, SemesterAction } from '@/actions/timetable/semester'; | ||
import { SemesterType } from '@/shapes/enum'; | ||
|
||
interface SemesterState { | ||
year: number | null; | ||
semester: SemesterType | null; | ||
} | ||
|
||
const initialState: SemesterState = { | ||
year: null, | ||
semester: null, | ||
}; | ||
|
||
const semester = (state = initialState, action: SemesterAction) => { | ||
switch (action.type) { | ||
case RESET: { | ||
return initialState; | ||
} | ||
case SET_SEMESTER: { | ||
return { | ||
year: action.year, | ||
semester: action.semester, | ||
}; | ||
} | ||
default: { | ||
return state; | ||
} | ||
} | ||
}; | ||
|
||
export default semester; |
Oops, something went wrong.