diff --git a/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsFragment.kt b/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsFragment.kt index 745c76d..e5f9a3e 100644 --- a/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsFragment.kt +++ b/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsFragment.kt @@ -18,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint class PlaylistsFragment : BaseFragment(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) @@ -57,7 +57,6 @@ class PlaylistsFragment : BaseFragment(R.layout.fragme override fun onPositiveButtonClicked(dialog: DialogFragment, title: String) { viewModel.createPlaylist(title) } - } private fun NavController.navigateToPlaylistDetail(playlistId: Int, title: String) { diff --git a/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsViewModel.kt b/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsViewModel.kt index f667a82..7037240 100644 --- a/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsViewModel.kt +++ b/android/feature/playlist/src/main/java/com/ohdodok/catchytape/feature/playlist/PlaylistsViewModel.kt @@ -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 @@ -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() { @@ -70,6 +70,7 @@ class PlaylistViewModel @Inject constructor( fun createPlaylist(playlistTitle: String) { viewModelScopeWithExceptionHandler.launch { playlistRepository.postPlaylist(playlistTitle) + fetchPlaylists() } } diff --git a/android/feature/playlist/src/main/res/layout/fragment_playlists.xml b/android/feature/playlist/src/main/res/layout/fragment_playlists.xml index 1df2ffd..6766338 100644 --- a/android/feature/playlist/src/main/res/layout/fragment_playlists.xml +++ b/android/feature/playlist/src/main/res/layout/fragment_playlists.xml @@ -7,7 +7,7 @@ + type="com.ohdodok.catchytape.feature.playlist.PlaylistsViewModel" />