From f86032ff459f57c8cda368b48888a39c848d263b Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 1 Jan 2022 16:32:45 +0100 Subject: Adds JSON decoding. --- src/Comm/LoadStory.elm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/Comm/LoadStory.elm (limited to 'src/Comm') diff --git a/src/Comm/LoadStory.elm b/src/Comm/LoadStory.elm new file mode 100644 index 0000000..869d21b --- /dev/null +++ b/src/Comm/LoadStory.elm @@ -0,0 +1,34 @@ +module Comm.LoadStory exposing (request) + +-- Elm ------------------------------------------------------------------------- +import Http + +-- Tonkadur -------------------------------------------------------------------- +import Tonkadur.Json + +-- Local Module ---------------------------------------------------------------- +import Struct.Event + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +request : String -> (Cmd Struct.Event.Type) +request story_url = + (Http.get + { + url = story_url, + expect = + (Http.expectJson + Struct.Event.LoadStory + (Tonkadur.Json.decoder) + ) + } + ) -- cgit v1.2.3-70-g09d2