diff options
Diffstat (limited to 'frontend/app/Page/EditValue.hs')
-rw-r--r-- | frontend/app/Page/EditValue.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/frontend/app/Page/EditValue.hs b/frontend/app/Page/EditValue.hs index feacd4a..4ff867f 100644 --- a/frontend/app/Page/EditValue.hs +++ b/frontend/app/Page/EditValue.hs @@ -15,22 +15,22 @@ import Data.Maybe import Effect (Eff) import Form qualified as F import Miso -import Miso.String (MisoString, toMisoString) +import Miso.String (toMisoString) import Safe (headMay) import Schema +import Collection data Model = Model - { collection :: MisoString, - fileName :: MisoString, + { collectionItem :: CollectionItem, input :: Maybe A.Object, schema :: Schema } deriving (Show, Eq) -initialModel :: MisoString -> MisoString -> JSM (Either SomeException Model) -initialModel collection fileName = do - schema' <- try (API.REST.Collection.schema collection) - input' <- try (headMay <$> API.REST.Collection.read collection fileName) +initialModel :: CollectionItem -> JSM (Either SomeException Model) +initialModel collectionItem = do + schema' <- try (API.REST.Collection.schema collectionItem.collection) + input' <- try (headMay <$> API.REST.Collection.read collectionItem) pure do schema <- schema' input <- input' @@ -43,7 +43,7 @@ update__formChanged (Just -> input) = Action $ \m -> (noEff m {input}, []) update__formSubmitted :: A.Object -> Action update__formSubmitted output = Action $ \m -> - (m <# do update__entityWritten <$> try (API.REST.Collection.update m.collection m.fileName output), []) + (m <# do update__entityWritten <$> try (API.REST.Collection.update m.collectionItem output), []) update__entityWritten :: Either SomeException A.Object -> Action update__entityWritten _ = Action $ \m -> (noEff m, []) |