Less modifyState identity

parent 6a64b6e0
......@@ -186,11 +186,11 @@ performAction (ChangePageSize ps) _ _ = void (cotransform (\state -> changePage
performAction (ChangePage p) _ _ = void (cotransform (\(TableData td) -> TableData $ td { currentPage = p} ))
performAction LoadData _ _ = void do
performAction LoadData _ _ = do
res <- lift $ loadPage
case res of
Left err -> cotransform $ \state -> state
Right resData -> modifyState (\s -> resData)
Left err -> pure unit
Right resData -> void $ modifyState (\s -> resData)
loadPage :: Aff (Either String CorpusTableData)
......
......@@ -18,13 +18,11 @@ getUser id = get $ "http://localhost:8008/node/" <> show id
performAction :: PerformAction State {} Action
performAction (FetchUser userId) _ _ = void do
performAction (FetchUser userId) _ _ = do
value <- lift $ getUser userId
_ <- case value of
(Right user) -> modifyState \state -> set _user (Just user) state
(Right user) -> void $ modifyState \state -> set _user (Just user) state
(Left err) -> do
_ <- liftEffect $ log err
modifyState identity
liftEffect $ log err
liftEffect <<< log $ "Fetching user..."
performAction _ _ _ = void do
modifyState identity
performAction _ _ _ = pure unit
......@@ -67,14 +67,14 @@ performAction Initialize _ state = void do
case lnodes of
Left err -> do
modifyState identity
pure unit
Right d -> do
_ <- modifyState $ _ { initialized = true, ntreeState = d}
page <- lift $ DV.loadPage
case page of
Left err -> do
modifyState identity
Right docs -> do
pure unit
Right docs -> void do
modifyState $ _ { initialized = true
, ntreeState = d
-- if length d > 0
......@@ -85,7 +85,7 @@ performAction Initialize _ state = void do
, docViewState = docs
}
_ -> do
modifyState identity
pure unit
performAction (LoginA _) _ _ = pure unit
performAction (AddCorpusA _) _ _ = pure unit
......
......@@ -33,17 +33,17 @@ performAction (SelectDatabase selected) _ _ = void do
performAction (UnselectDatabase unselected) _ _ = void do
modifyState \( state) -> state { unselect_database = unselected }
performAction (LoadDatabaseDetails) _ _ = void do
performAction (LoadDatabaseDetails) _ _ = do
res <- lift $ getDatabaseDetails $ QueryString { query_query: "string",query_name: ["Pubmed"]}
case res of
Left err -> modifyState $ \(state) -> state
Left err -> pure unit
Right resData -> do
modifyState $ \(state) -> state {response = resData}
void $ modifyState $ \(state) -> state {response = resData}
performAction GO _ _ = void do
_ <- liftEffect $ setHash "/corpus"
_ <- liftEffect $ modalHide "addCorpus"
modifyState identity
performAction GO _ _ = do
liftEffect $ setHash "/corpus"
liftEffect $ modalHide "addCorpus"
pure unit
newtype QueryString = QueryString
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment