You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/kotlin/org/datepollsystems/waiterrobot/mediator/ui/configurePrinters/ConfigurePrintersViewModel.kt
+18-20Lines changed: 18 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,12 @@ class ConfigurePrintersViewModel(
29
29
init {
30
30
val initConfig =MediatorConfiguration.createFromStore()
31
31
inVmScope {
32
-
val organisations = loadUserOrganisations()
32
+
loadUserOrganisations(
33
+
selectId = initConfig?.selectedOrganisationId,
34
+
selectEventId = initConfig?.selectedEventId
35
+
)
33
36
if (initConfig !=null) {
34
-
val selectedOrg = organisations.find { it.id == initConfig.selectedOrganisationId }
35
-
36
-
val events =if (selectedOrg !=null) loadOrganisationEvents(selectedOrg.id) elsenull
37
-
val selectedEvent = events?.find { it.id == initConfig.selectedEventId }
38
-
37
+
val selectedEvent = state.value.selectedEvent
39
38
val bePrinters =if (selectedEvent !=null) loadEventPrinters(selectedEvent.id) elsenull
40
39
val backendMap = bePrinters?.associateBy(GetPrinterDto::id) ?: emptyMap()
41
40
val localIds =PrinterDiscoverService.localPrinters.map(LocalPrinterInfo::localId)
@@ -56,15 +55,10 @@ class ConfigurePrintersViewModel(
0 commit comments