Skip to content

Commit

Permalink
fix : 재생 목록 추가시 UI 즉시 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
HamBP committed Dec 12, 2023
1 parent c15c412 commit 0ed536c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragment_playlists),
NewPlaylistDialog.NewPlaylistDialogListener {

val viewModel: PlaylistViewModel by viewModels()
val viewModel: PlaylistsViewModel by viewModels()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand Down Expand Up @@ -57,7 +57,6 @@ class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragme
override fun onPositiveButtonClicked(dialog: DialogFragment, title: String) {
viewModel.createPlaylist(title)
}

}

private fun NavController.navigateToPlaylistDetail(playlistId: Int, title: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.ohdodok.catchytape.core.domain.model.CtErrorType
import com.ohdodok.catchytape.core.domain.model.CtException
import com.ohdodok.catchytape.core.domain.model.Playlist
import com.ohdodok.catchytape.core.domain.repository.PlaylistRepository
import com.ohdodok.catchytape.core.ui.model.PlaylistUiModel
import com.ohdodok.catchytape.core.domain.usecase.playlist.GetPlaylistsUseCase
import com.ohdodok.catchytape.core.ui.model.PlaylistUiModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.flow.MutableSharedFlow
Expand All @@ -27,7 +27,7 @@ data class PlaylistsUiState(
)

@HiltViewModel
class PlaylistViewModel @Inject constructor(
class PlaylistsViewModel @Inject constructor(
private val getPlaylistsUseCase: GetPlaylistsUseCase,
private val playlistRepository: PlaylistRepository
) : ViewModel() {
Expand Down Expand Up @@ -70,6 +70,7 @@ class PlaylistViewModel @Inject constructor(
fun createPlaylist(playlistTitle: String) {
viewModelScopeWithExceptionHandler.launch {
playlistRepository.postPlaylist(playlistTitle)
fetchPlaylists()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<variable
name="viewModel"
type="com.ohdodok.catchytape.feature.playlist.PlaylistViewModel" />
type="com.ohdodok.catchytape.feature.playlist.PlaylistsViewModel" />

</data>

Expand Down

0 comments on commit 0ed536c

Please sign in to comment.