aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Page
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/Page')
-rw-r--r--frontend/app/Page/EditValue.hs11
-rw-r--r--frontend/app/Page/ListCollection.hs5
-rw-r--r--frontend/app/Page/NewCollection.hs23
3 files changed, 23 insertions, 16 deletions
diff --git a/frontend/app/Page/EditValue.hs b/frontend/app/Page/EditValue.hs
index d5a87e7..43c6f17 100644
--- a/frontend/app/Page/EditValue.hs
+++ b/frontend/app/Page/EditValue.hs
@@ -15,6 +15,7 @@ import Data.Maybe
import Form qualified as F
import Miso
import Miso.String (toMisoString)
+import Effect (Eff)
import Schema
data Model = Model
@@ -41,12 +42,12 @@ data Action
| EntityWritten (Either String ())
deriving (Eq, Show)
-updateModel :: Action -> Model -> Effect Action Model
-updateModel NoOp m = noEff m
-updateModel (FormChanged (Just -> input)) m = noEff m {input}
+updateModel :: Action -> Model -> (Effect Action Model, [Eff])
+updateModel NoOp m = (noEff m, [])
+updateModel (FormChanged (Just -> input)) m = (noEff m {input}, [])
updateModel (FormSubmitted output) m =
- m <# do EntityWritten <$> updatePost m.fileName output
-updateModel (EntityWritten _) m = noEff m
+ (m <# do EntityWritten <$> updatePost m.fileName output, [])
+updateModel (EntityWritten _) m = (noEff m, [])
viewModel :: Model -> View Action
viewModel m = do
diff --git a/frontend/app/Page/ListCollection.hs b/frontend/app/Page/ListCollection.hs
index d08e414..93ea389 100644
--- a/frontend/app/Page/ListCollection.hs
+++ b/frontend/app/Page/ListCollection.hs
@@ -12,6 +12,7 @@ import Data.Aeson qualified as A
import Data.Aeson.KeyMap qualified as AM
import Miso
import Schema
+import Effect (Eff)
data Model = Model
{ collection :: String,
@@ -34,8 +35,8 @@ data Action
= NoOp
deriving (Eq, Show)
-updateModel :: Action -> Model -> Effect Action Model
-updateModel NoOp m = noEff m
+updateModel :: Action -> Model -> (Effect Action Model, [Eff])
+updateModel NoOp m = (noEff m, [])
viewModel :: Model -> View Action
viewModel m =
diff --git a/frontend/app/Page/NewCollection.hs b/frontend/app/Page/NewCollection.hs
index 282d36e..dbc448b 100644
--- a/frontend/app/Page/NewCollection.hs
+++ b/frontend/app/Page/NewCollection.hs
@@ -10,6 +10,8 @@ where
import Api
import Data.Aeson qualified as A
import Data.Text qualified as T
+import Effect (Eff)
+import Effect qualified as E
import Form qualified as F
import Miso
import Miso.String (toMisoString)
@@ -30,17 +32,20 @@ data Action
| CollectionCreated (Either String ())
deriving (Eq, Show)
-updateModel :: Action -> Model -> Effect Action Model
-updateModel NoOp m = noEff m
-updateModel (FormChanged input) m = noEff m {input}
+updateModel :: Action -> Model -> (Effect Action Model, [Eff])
+updateModel NoOp m = (noEff m, [])
+updateModel (FormChanged input) m = (noEff m {input}, [])
updateModel (FormSubmitted collection) m =
- m <# do
- CollectionCreated <$> createCollection (T.unpack collection)
+ ( m <# do
+ CollectionCreated <$> createCollection (T.unpack collection),
+ []
+ )
updateModel (CollectionCreated (Left err)) m =
- m <# do
- pure NoOp <* consoleLog (toMisoString err)
--- TODO reload collections in main app
-updateModel (CollectionCreated (Right _)) m = noEff m
+ ( m <# do
+ pure NoOp <* consoleLog (toMisoString err),
+ []
+ )
+updateModel (CollectionCreated (Right _)) m = (noEff m, [E.ReloadCollections])
viewModel :: Model -> View Action
viewModel m = do