Skip to content

Commit

Permalink
[feat] #188 업로드 실패하면 다시 Empty 상태로 초기화 해서 스낵바 반복해서 뜨지 않도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeha committed Sep 7, 2023
1 parent f085d23 commit 9d236f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class AmountFragment : BindingFragment<FragmentAmountBinding>(R.layout.fragment_

private fun initUploadButtonClickListener() {
binding.btnAmountNext.setOnSingleClickListener {
uploadViewModel.postWineyFeed(uploadViewModel.content, uploadViewModel.amount.removeComma())
uploadViewModel.apply {
postWineyFeed(content, amount.removeComma())
}
}
}

Expand All @@ -67,6 +69,7 @@ class AmountFragment : BindingFragment<FragmentAmountBinding>(R.layout.fragment_

is UiState.Failure -> {
wineySnackbar(binding.root, false, stringOf(R.string.snackbar_upload_fail))
uploadViewModel.initPostWineyFeedState()
}

is UiState.Empty -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ class UploadViewModel @Inject constructor(
}
}

fun initPostWineyFeedState() {
_postWineyFeedState.value = UiState.Empty
}

private fun createRequestBody(
content: String,
amount: String
Expand Down

0 comments on commit 9d236f2

Please sign in to comment.