diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-06-14 20:56:07 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-10-11 20:38:29 +0200 |
commit | 2e0cf98254976e443ea7f693961fc105ed6cf563 (patch) | |
tree | 271c8a73c14b6fffe6504494d61f68d7fda5e59e /frontend/app/Page/ListCollection.hs | |
parent | 07a2f177f440526a374ef3844a1c37ba38939861 (diff) |
refactor actions
Diffstat (limited to 'frontend/app/Page/ListCollection.hs')
-rw-r--r-- | frontend/app/Page/ListCollection.hs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/frontend/app/Page/ListCollection.hs b/frontend/app/Page/ListCollection.hs index 93ea389..9acca3c 100644 --- a/frontend/app/Page/ListCollection.hs +++ b/frontend/app/Page/ListCollection.hs @@ -10,9 +10,9 @@ where import Api import Data.Aeson qualified as A import Data.Aeson.KeyMap qualified as AM +import Effect (Eff) import Miso import Schema -import Effect (Eff) data Model = Model { collection :: String, @@ -31,12 +31,10 @@ initialModel collection = do posts <- posts' pure $ Model {input = A.Object AM.empty, ..} -data Action - = NoOp - deriving (Eq, Show) +newtype Action = Action (Model -> (Effect Action Model, [Eff])) updateModel :: Action -> Model -> (Effect Action Model, [Eff]) -updateModel NoOp m = (noEff m, []) +updateModel (Action f) m = f m viewModel :: Model -> View Action viewModel m = |