Skip to content

Commit

Permalink
[feature/#1011] 핸드폰 인증 검사 서버통신 모든 케이스 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeyubin committed Jan 2, 2025
1 parent fba3641 commit 81a4db6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand Down Expand Up @@ -100,10 +97,10 @@ internal fun CertificationRoute(
onBackClick = onBackClick,
onCreateCodeClick = {
onShowSnackBar()
viewModel.createCode()
viewModel.createCode(status)
},
onCertificateClick = {
viewModel.certificateCode()
viewModel.certificateCode(status)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class CertificationViewModel @Inject constructor(

private val _sideEffect = MutableSharedFlow<CertificationSideEffect>()
val sideEffect: SharedFlow<CertificationSideEffect> = _sideEffect.asSharedFlow()
fun createCode() {
fun createCode(status: AuthStatus) {
viewModelScope.launch {
repository.createCode(
InitialInformation(
name = "Mock-Success-Register",
phone = "01012345678",
type = AuthStatus.REGISTER.type
name = status.authName,
phone = status.phone,
type = status.type
)
).onSuccess {
_sideEffect.emit(CertificationSideEffect.ShowToast("성공!!!"))
Expand All @@ -36,14 +36,14 @@ class CertificationViewModel @Inject constructor(
}
}

fun certificateCode() {
fun certificateCode(status: AuthStatus) {
viewModelScope.launch {
repository.certificateCode(
InformationWithCode(
name = "Mock-Success-Register",
phone = "01012345678",
code = "123456",
type = AuthStatus.REGISTER.type
name = status.authName,
phone = status.phone,
code = status.code,
type = status.type
)
).onSuccess {
_sideEffect.emit(CertificationSideEffect.NavigateToSocialAccount)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
package org.sopt.official.feature.auth.model

enum class AuthStatus(val type: String) {
REGISTER("REGISTER"),
CHANGE("CHANGE"),
SEARCH("SEARCH")
// TODO: mock서버 삭제 시 authName, phone, code는 같이 없어질 예정입니다.
enum class AuthStatus(
val authName: String,
val phone: String,
val type: String,
val code: String
) {
REGISTER(
authName = "Mock-Success-Register",
phone = "01012345678",
type = "REGISTER",
code = "123456"
),
CHANGE(
authName = "Mock-Success-Change",
phone = "01087654321",
type = "CHANGE",
code = "654321"
),
SEARCH(
authName = "Mock-Success-Search",
phone = "01013245768",
type = "SEARCH",
code = "132456"
)
}

0 comments on commit 81a4db6

Please sign in to comment.