aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Page/NewCollection.hs
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app/Page/NewCollection.hs')
-rw-r--r--frontend/app/Page/NewCollection.hs23
1 files changed, 14 insertions, 9 deletions
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