diff --git a/budget-binder-multiplatform-app/src/commonMain/kotlin/de/hsfl/budgetBinder/presentation/viewmodel/entry/EntryViewModel.kt b/budget-binder-multiplatform-app/src/commonMain/kotlin/de/hsfl/budgetBinder/presentation/viewmodel/entry/EntryViewModel.kt index 9c81ccca..82ca8bdb 100644 --- a/budget-binder-multiplatform-app/src/commonMain/kotlin/de/hsfl/budgetBinder/presentation/viewmodel/entry/EntryViewModel.kt +++ b/budget-binder-multiplatform-app/src/commonMain/kotlin/de/hsfl/budgetBinder/presentation/viewmodel/entry/EntryViewModel.kt @@ -131,21 +131,30 @@ class EntryViewModel( private fun create(entry: Entry.In) = scope.launch { entryUseCases.createNewEntryUseCase(entry).collect { it.handleDataResponse( - 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( - 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( - routerFlow = routerFlow, onSuccess = { routerFlow.navigateTo(Screen.Dashboard) }) + routerFlow = routerFlow, onSuccess = { + routerFlow.navigateTo(Screen.Dashboard) + eventFlow.emit(UiEvent.ShowSuccess("Entry successfully deleted")) + }) } } diff --git a/budget-binder-multiplatform-app/src/jsMain/kotlin/main.kt b/budget-binder-multiplatform-app/src/jsMain/kotlin/main.kt index c6b10d59..72aa52b4 100644 --- a/budget-binder-multiplatform-app/src/jsMain/kotlin/main.kt +++ b/budget-binder-multiplatform-app/src/jsMain/kotlin/main.kt @@ -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) {