Skip to content

Commit

Permalink
remove: local 약관 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
yangsooplus committed Jun 2, 2024
1 parent 3a44819 commit a02402f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ fun SignUpRoute(
val context = LocalContext.current
val uiState: SignUpState by viewModel.uiState.collectAsStateWithLifecycle()
val termState: TermState by termViewModel.uiState.collectAsStateWithLifecycle()
val localTerms = remember {
persistentListOf(
Term(id = 0, title = context.getString(R.string.signup_term_over_14), isEssential = true, canRead = false),
)
}

BackHandler {
viewModel.goPreviousStep()
Expand All @@ -86,7 +81,7 @@ fun SignUpRoute(
}

LaunchedEffect(key1 = Unit) {
termViewModel.getTermList(localTerms = localTerms)
termViewModel.getTermList()
}

Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.susu.domain.usecase.loginsignup.GetTermDetailUseCase
import com.susu.domain.usecase.loginsignup.GetTermsUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand All @@ -16,11 +17,11 @@ class TermViewModel @Inject constructor(
private val getTermDetailUseCase: GetTermDetailUseCase,
) : BaseViewModel<TermState, TermEffect>(TermState()) {

fun getTermList(localTerms: PersistentList<Term>) {
fun getTermList() {
viewModelScope.launch {
intent { copy(isLoading = true) }
getTermsUseCase().onSuccess {
intent { copy(terms = localTerms.addAll(it), isLoading = false) }
intent { copy(terms = it.toPersistentList(), isLoading = false) }
}.onFailure {
postSideEffect(TermEffect.ShowToast(it.message ?: "약관을 불러오지 못했어요"))
}
Expand Down

0 comments on commit a02402f

Please sign in to comment.