diff options
author | Ben Sima <ben@bsima.me> | 2020-12-30 12:20:07 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-12-30 12:20:07 -0500 |
commit | f0895bfd73c53d9d5d9811c632d8e6f5e99dc0d4 (patch) | |
tree | 29c446dc76c8c4f14cea67189c3d91ad0b1db4cc /Biz/Ibb/Move.hs | |
parent | 2d6075d13a9d2cf023cb34a079b0c071af9ee650 (diff) |
Remove Biz/Ibb
Diffstat (limited to 'Biz/Ibb/Move.hs')
-rw-r--r-- | Biz/Ibb/Move.hs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/Biz/Ibb/Move.hs b/Biz/Ibb/Move.hs deleted file mode 100644 index 2135f85..0000000 --- a/Biz/Ibb/Move.hs +++ /dev/null @@ -1,53 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE NoImplicitPrelude #-} - --- | App update logic -module Biz.Ibb.Move - ( move, - - -- * Server interactions - fetchPeople, - ) -where - -import Alpha -import Biz.Ibb.Core as Core -import Data.Aeson -import JavaScript.Web.XMLHttpRequest - ( Method (GET), - Request (..), - 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 - } |