Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/web-compose-frontend' into web-c…
Browse files Browse the repository at this point in the history
…ompose-frontend
  • Loading branch information
Dominik Heckner committed Jun 24, 2022
2 parents a65f9a2 + aa9ba12 commit 9f3c0da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,30 @@ class EntryViewModel(
private fun create(entry: Entry.In) = scope.launch {
entryUseCases.createNewEntryUseCase(entry).collect {
it.handleDataResponse<Entry>(
routerFlow = routerFlow, onSuccess = { routerFlow.navigateTo(Screen.Dashboard) })
routerFlow = routerFlow, onSuccess = {
routerFlow.navigateTo(Screen.Dashboard)
eventFlow.emit(UiEvent.ShowSuccess("Entry successfully created"))
})
}
}

private fun update(entry: Entry.Patch, id: Int) = scope.launch {
entryUseCases.changeEntryByIdUseCase(entry, id).collect {
it.handleDataResponse<Entry>(
routerFlow = routerFlow, onSuccess = { routerFlow.navigateTo(Screen.Dashboard) })
routerFlow = routerFlow, onSuccess = {
routerFlow.navigateTo(Screen.Dashboard)
eventFlow.emit(UiEvent.ShowSuccess("Entry successfully updated"))
})
}
}

private fun delete(id: Int) = scope.launch {
entryUseCases.deleteEntryByIdUseCase(id).collect {
it.handleDataResponse<Entry>(
routerFlow = routerFlow, onSuccess = { routerFlow.navigateTo(Screen.Dashboard) })
routerFlow = routerFlow, onSuccess = {
routerFlow.navigateTo(Screen.Dashboard)
eventFlow.emit(UiEvent.ShowSuccess("Entry successfully deleted"))
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion budget-binder-multiplatform-app/src/jsMain/kotlin/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ val di = kodein(ktorEngine = Js.create())
@Composable
fun App() = withDI(di) {
val uiEventFlow: UiEventSharedFlow by di.instance()
val loadingState = remember { mutableStateOf(false) }
val loadingState = remember { mutableStateOf(true) }
val snackBarText = remember { mutableStateOf("") }
val snackBarHidden = remember { mutableStateOf(true) }
LaunchedEffect(key1 = true) {
Expand Down

0 comments on commit 9f3c0da

Please sign in to comment.