Skip to content

Commit

Permalink
[FEATURE] #125 : 출석 코드 공란일 때 출석 등록할 수 없도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 17, 2024
1 parent 3a53696 commit 3bb2ee2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ internal fun AttendanceManagementRoute(
viewModel.attendanceManagementEvent.collect { event ->
when (event) {
is AttendanceManagementEvent.Success -> navigateToAttendance()

is AttendanceManagementEvent.Failure ->
snackBarHostState.showSnackbar(message = event.message)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ class AttendanceManagementViewModel @Inject constructor(
}

fun postAttendance() = viewModelScope.launch {
if (_attendanceCode.value.isEmpty()) {
_attendanceManagementEvent.emit(
AttendanceManagementEvent.Failure("출석 코드는 공란일 수 없습니다."),
)
return@launch
}

postAttendanceUseCase(
eventId = selectedEventId.value,
code = _attendanceCode.value,
Expand Down Expand Up @@ -81,5 +88,6 @@ class AttendanceManagementViewModel @Inject constructor(

sealed class AttendanceManagementEvent {
data object Success : AttendanceManagementEvent()
data class Failure(val message: String) : AttendanceManagementEvent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal fun RegistrationTextField(
color = WappTheme.colors.gray82,
textAlign = TextAlign.Center,
style = WappTheme.typography.contentMedium,
modifier = Modifier.align(Alignment.Center),
modifier = Modifier.align(align),
)
}

Expand Down

0 comments on commit 3bb2ee2

Please sign in to comment.