Skip to content

Commit 92a8b31

Browse files
committed
Miso.Fetch: remove, superseded by servant-client-core
and corresponding adapter packages like servant-jsaddle
1 parent bac7bea commit 92a8b31

File tree

4 files changed

+0
-249
lines changed

4 files changed

+0
-249
lines changed

miso.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ library
154154
Miso.Event.Decoder
155155
Miso.Event.Types
156156
Miso.Exception
157-
Miso.Fetch
158157
Miso.FFI
159158
Miso.FFI.History
160159
Miso.FFI.SSE

src/Miso.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ module Miso
4343
, module Miso.Subscription
4444
-- * Storage
4545
, module Miso.Storage
46-
-- * Fetch
47-
, module Miso.Fetch
4846
-- * Util
4947
, module Miso.Util
5048
-- * FFI
@@ -65,7 +63,6 @@ import Miso.Diff
6563
import Miso.Effect
6664
import Miso.Event
6765
import Miso.Exception
68-
import Miso.Fetch
6966
import Miso.FFI
7067
import qualified Miso.FFI.Internal as FFI
7168
import Miso.Html

src/Miso/FFI/Internal.hs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module Miso.FFI.Internal
5454
, setBodyComponent
5555
, addStyle
5656
, addStyleSheet
57-
, fetchJSON
5857
, shouldSync
5958
) where
6059
-----------------------------------------------------------------------------
@@ -408,53 +407,6 @@ addStyleSheet url = do
408407
_ <- link # "setAttribute" $ ["href", fromMisoString url]
409408
void $ jsg "document" ! "head" # "appendChild" $ [link]
410409
-----------------------------------------------------------------------------
411-
-- | Retrieve JSON via Fetch API
412-
--
413-
-- Basic GET of JSON using Fetch API, will be expanded upon.
414-
--
415-
-- See <https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API>
416-
--
417-
fetchJSON
418-
:: FromJSON action
419-
=> MisoString
420-
-- ^ url
421-
-> MisoString
422-
-- ^ method
423-
-> Maybe MisoString
424-
-- ^ body
425-
-> [(MisoString,MisoString)]
426-
-- ^ headers
427-
-> (action -> JSM ())
428-
-- ^ successful callback
429-
-> (MisoString -> JSM ())
430-
-- ^ errorful callback
431-
-> JSM ()
432-
fetchJSON url method maybeBody headers successful errorful = do
433-
successful_ <- toJSVal =<< do
434-
asyncCallback1 $ \jval ->
435-
fromJSON <$> fromJSValUnchecked jval >>= \case
436-
Error string ->
437-
error ("fetchJSON: " <> string <> ": decode failure")
438-
Success result -> do
439-
successful result
440-
errorful_ <- toJSVal =<< do
441-
asyncCallback1 $ \jval ->
442-
errorful =<< fromJSValUnchecked jval
443-
moduleMiso <- jsg "miso"
444-
url_ <- toJSVal url
445-
method_ <- toJSVal method
446-
body_ <- toJSVal maybeBody
447-
let jsonHeaders =
448-
[(ms "Content-Type", ms "application/json") | isJust maybeBody]
449-
<>
450-
[(ms "Accept", ms "application/json")]
451-
Object headers_ <- do
452-
o <- create
453-
forM_ (headers <> jsonHeaders) $ \(k,v) -> do
454-
set k v o
455-
pure o
456-
void $ moduleMiso # "fetchJSON" $ [url_, method_, body_, headers_, successful_, errorful_]
457-
-----------------------------------------------------------------------------
458410
-- | shouldSync
459411
--
460412
-- Used to set whether or not the current VNode should enter the 'syncChildren'

src/Miso/Fetch.hs

Lines changed: 0 additions & 197 deletions
This file was deleted.

0 commit comments

Comments
 (0)