-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT/#17] week7-compose / 필수과제 #19
base: develop-compose
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿!! 7주차 과제까지 너무 수고하셨습니당~!!!! 외쳐 갓문수
class SignUpViewModelFactory(private val signUpRepository: SignUpRepository) : ViewModelProvider.Factory { | ||
override fun <T : ViewModel> create(modelClass: Class<T>): T { | ||
if (modelClass.isAssignableFrom(SignUpViewModel::class.java)) { | ||
@Suppress("UNCHECKED_CAST") | ||
return SignUpViewModel(signUpRepository) as T | ||
} | ||
throw IllegalArgumentException("알 수 없는 ViewModel 클래스") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
팩토리에서 이 부분이 반복되는 것 같은데 어떻게 반복을 없앨 수 있을지 생각해보면 좋을 것 같아요!
} | ||
}.getOrElse { | ||
Result.failure(it) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOrElse
는 어떤 기능을 하나용..?
val result = signUpRepository.signUp(signUpDto) | ||
_signUpState.value = if (result.isSuccess) { | ||
SignUpState.Success("회원가입 성공") | ||
} else { | ||
SignUpState.Error(result.exceptionOrNull()?.message ?: "회원가입 실패") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val result = signUpRepository.signUp(signUpDto) | |
_signUpState.value = if (result.isSuccess) { | |
SignUpState.Success("회원가입 성공") | |
} else { | |
SignUpState.Error(result.exceptionOrNull()?.message ?: "회원가입 실패") | |
signUpRepository.signUp( | |
signUpDto | |
).onSuccess { | |
_signUpState.value = SignUpState.Success("회원가입 성공") | |
}.onFailure{ | |
_signUpState.value = SignUpState.Error(result.exceptionOrNull()?.message ?: "회원가입 실패") | |
} |
취향차이일 수는 있을 것 같은데 result를 따로 변수화하지 않고도 사용해줄 수 있을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
열심히 하셨군요!!!!
val response = chain.proceed(request) | ||
|
||
// 응답 헤더에서 Location 값 추출해서 memberId에 저장 때리기 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 때리기 삭제한 거 웃기네
import com.sopt.now.data.model.RequestLoginDto | ||
import com.sopt.now.data.model.ResponseLoginDto | ||
|
||
interface LoginRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
레포지토리 다 나눈 거 깔끔하네요-!!
is LoginState.Loading -> CircularProgressIndicator() | ||
is LoginState.Success -> { | ||
LaunchedEffect(state.message) { | ||
Toast.makeText(context, state.message, Toast.LENGTH_LONG).show() | ||
toast(context, state.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 쓰니까 훨씬 깔끔하네요! 배우고 갑니당
📌issue
📄Work Description
📷Record
📢To Reviewers