reload collections when creating

This commit is contained in:
Alexander Foremny
2024-06-07 17:08:01 +02:00
parent 8a34cc822c
commit 2e67bf9115
8 changed files with 60 additions and 26 deletions

View File

@@ -16,6 +16,7 @@ import Page.ListCollection qualified as ListCollection
import Page.NewCollection qualified as NewCollection
import Route (Route)
import Route qualified as Route
import Effect (Eff)
data Page
= Home
@@ -42,19 +43,19 @@ initialPage (Route.EditValue c f) =
initialPage Route.NewCollection =
fmap NewCollection <$> NewCollection.initialModel
updatePage :: Action -> Page -> Effect Action Page
updatePage :: Action -> Page -> (Effect Action Page, [Eff])
updatePage (HandleListCollection action) (ListCollection m) =
ListCollection.updateModel action m
& bimap HandleListCollection ListCollection
updatePage (HandleListCollection _) p = noEff p
& first (bimap HandleListCollection ListCollection)
updatePage (HandleListCollection _) p = (noEff p, [])
updatePage (HandleEditValue action) (EditValue m) =
EditValue.updateModel action m
& bimap HandleEditValue EditValue
updatePage (HandleEditValue _) p = noEff p
& first (bimap HandleEditValue EditValue)
updatePage (HandleEditValue _) p = (noEff p, [])
updatePage (HandleNewCollection action) (NewCollection m) =
NewCollection.updateModel action m
& bimap HandleNewCollection NewCollection
updatePage (HandleNewCollection _) p = noEff p
& first (bimap HandleNewCollection NewCollection)
updatePage (HandleNewCollection _) p = (noEff p, [])
viewPage :: Page -> View Action
viewPage Home = text "home"