diff options
author | Ben Sima <ben@bsima.me> | 2019-10-27 09:48:52 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-10-27 12:14:40 -0700 |
commit | c790672cc244ac4caba1bda3572829a6c6862891 (patch) | |
tree | 2706bb8044f7b14840c5f90f215b79b433e81045 /lore/Biz/Ibb/Move.hs | |
parent | 44df4ba39f65c3afd84bee6b03f47d9b061e9038 (diff) |
move everything to namespace directories
Diffstat (limited to 'lore/Biz/Ibb/Move.hs')
-rw-r--r-- | lore/Biz/Ibb/Move.hs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/lore/Biz/Ibb/Move.hs b/lore/Biz/Ibb/Move.hs deleted file mode 100644 index 0d83e8a..0000000 --- a/lore/Biz/Ibb/Move.hs +++ /dev/null @@ -1,43 +0,0 @@ -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} - --- | App update logic -module Biz.Ibb.Move ( - move - -- * Server interactions - , fetchPeople - ) where - -import Alpha -import Data.Aeson -import Biz.Ibb.Core as Core -import JavaScript.Web.XMLHttpRequest (Request(..), Method(GET), RequestData(NoData), contents, xhrByteString) -import Miso -import Miso.String -import Network.RemoteData - -move :: Action -> Model -> Effect Action Model -move Nop m = noEff m -move (HandleRoute u) m = m { uri = u } <# pure Nop -move (ChangeRoute u) m = m <# do pushURI u >> pure Nop -move FetchPeople m = m <# (SetPeople /@ fetchPeople) -move (SetPeople ps) m = noEff m { people = ps } - -fetchPeople :: IO (WebData [Core.Person]) -fetchPeople = do - mjson <- contents /@ xhrByteString req - case mjson of - Nothing -> pure $ Failure "could not read from server" - Just a -> pure - $ fromEither - $ either (Left . ms) pure - $ eitherDecodeStrict a - where - req = Request { reqMethod = GET - -- FIXME: can replace this hardcoding with a function? - , reqURI = "/api/people" - , reqLogin = Nothing - , reqHeaders = [] - , reqWithCredentials = False - , reqData = NoData - } |