-
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.
* feat: 제한 시간 기능 추가 - 빈 입력이나 기본 값(35초)을 수정하지 않을 경우 35초로 설정됩니다. - 10초 미만인 입력 값은 10초로 조정되게 했습니다. - 제한 시간 안내 문구를 추가했습니다. - courseRegisterSlice에 제한 시간을 추가했습니다. - 로그아웃시 courseRegisterSlice 데이터를 초기화하도록 했습니다. * feat: 카운트다운 추가 - 분:초로 표시됩니다. - 최대 시간을 1시간으로 설정했습니다. - 5초 이하일 때에는 빨간색으로 출력 되도록 했습니다.
- Loading branch information
1 parent
e57d6fa
commit 9ba4e1a
Showing
4 changed files
with
150 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,48 @@ | ||
import {createSlice} from '@reduxjs/toolkit'; | ||
|
||
export interface CourseRegistered { | ||
endCount: boolean | ||
endCount: boolean; | ||
time: number; | ||
} | ||
|
||
const courseRegistered = createSlice({ | ||
name: 'courseRegistered', | ||
initialState: { | ||
endCount: false, | ||
time: 35, | ||
}, | ||
reducers: { | ||
setEndCount(state: CourseRegistered, {payload}: {payload: boolean}) { | ||
state.endCount = payload; | ||
}, | ||
|
||
setTime(state: CourseRegistered, {payload}: {payload: number}) { | ||
if (payload <= 10) { | ||
state.time = 10; | ||
} else if (payload >= 3600) { | ||
state.time = 3600; | ||
} else { | ||
state.time = payload; | ||
} | ||
}, | ||
clearCount(state: CourseRegistered) { | ||
state.endCount = false; | ||
}, | ||
cleatTime(state: CourseRegistered) { | ||
state.time = 35; | ||
}, | ||
resetCourseRegistered(state: CourseRegistered) { | ||
state.endCount = false; | ||
state.time = 35; | ||
}, | ||
}, | ||
}); | ||
|
||
export const {setEndCount, clearCount} = courseRegistered.actions; | ||
export const { | ||
setEndCount, | ||
setTime, | ||
clearCount, | ||
cleatTime, | ||
resetCourseRegistered, | ||
} = courseRegistered.actions; | ||
|
||
export default courseRegistered.reducer; | ||
export default courseRegistered.reducer; |