Skip to content

Commit e947e47

Browse files
committed
Improve GalleryDetailViewModel delete method
1 parent 9f495f8 commit e947e47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/gallery/detail/GalleryDetailViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class GalleryDetailViewModel(
9797
}
9898

9999
private fun delete() {
100-
if (currentState !is GalleryDetailState.Content) return
101-
!deleteGalleryItemUseCase((currentState as GalleryDetailState.Content).id)
100+
val state = currentState as? GalleryDetailState.Content ?: return
101+
!deleteGalleryItemUseCase(state.id)
102102
.subscribeOnMainThread(schedulersProvider)
103103
.subscribeBy(::errorLog) { mainRouter.navigateBack() }
104104
}

0 commit comments

Comments
 (0)