From 2e0cf98254976e443ea7f693961fc105ed6cf563 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Fri, 14 Jun 2024 20:56:07 +0200 Subject: refactor actions --- frontend/app/Page/ListCollection.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'frontend/app/Page/ListCollection.hs') 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 = -- cgit v1.2.3