aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Page.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-07 17:08:01 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-08 09:56:20 +0200
commit2e67bf911533a66b5a5b7b50481b426adff8c7db (patch)
tree71481ebe7602ea3d5c84438d0ca829e26ca75a2a /frontend/app/Page.hs
parent8a34cc822c2c508472fe29ab2be1b74ba06e59e6 (diff)
reload collections when creating
Diffstat (limited to 'frontend/app/Page.hs')
-rw-r--r--frontend/app/Page.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/frontend/app/Page.hs b/frontend/app/Page.hs
index 16191dd..7c200c8 100644
--- a/frontend/app/Page.hs
+++ b/frontend/app/Page.hs
@@ -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"