Skip to content

Commit

Permalink
chore: Use uiState directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Nov 26, 2024
1 parent fe3e43f commit de65739
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ fun TransferDetailsScreen(
transferDetailsViewModel: TransferDetailsViewModel = hiltViewModel<TransferDetailsViewModel>(),
) {
val uiState by transferDetailsViewModel.uiState.collectAsStateWithLifecycle()
val isLoading by remember { derivedStateOf { uiState is Loading } }
val isDelete by remember { derivedStateOf { uiState is Delete } }

LaunchedEffect(transferUuid) {
transferDetailsViewModel.loadTransfer(transferUuid)
}

if (isDelete) {
if (uiState is Delete) {
navigateBack?.invoke()
} else if (!isLoading) {
} else if (uiState is Success) {
TransferDetailsScreen(
transferUrl = transferDetailsViewModel.getTransferUrl(transferUuid),
direction = direction,
Expand Down

0 comments on commit de65739

Please sign in to comment.