Skip to content

Commit

Permalink
[AN/USER] feat: 학생 인증 화면 학교 도메인 디폴트 값 제거 (#550) (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC authored Oct 17, 2023
1 parent 1d9b10a commit 660e80c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ class SchoolDefaultRepository @Inject constructor(
.onSuccessOrCatch { it.toDomain() }

override suspend fun loadSchoolEmail(schoolId: Long): Result<String> {
// TODO: API 연동 작업 필요
return Result.success("festago.com")
return runCatchingResponse { schoolRetrofitService.getSchools() }
.onSuccessOrCatch {
val school = it.schools.find { school -> school.id.toLong() == schoolId }
school?.domain ?: throw IllegalArgumentException(MATCH_SCHOOL_NOT_FOUND)
}
}

companion object {
private const val MATCH_SCHOOL_NOT_FOUND = "MATCH_SCHOOL_NOT_FOUND"
}
}

0 comments on commit 660e80c

Please sign in to comment.