diff options
Diffstat (limited to 'frontend/app/Api.hs')
-rw-r--r-- | frontend/app/Api.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/frontend/app/Api.hs b/frontend/app/Api.hs index f4e4599..2aa23c9 100644 --- a/frontend/app/Api.hs +++ b/frontend/app/Api.hs @@ -1,7 +1,8 @@ {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} module Api - ( fetchSchema, + ( fetchCollections, + fetchSchema, fetchSchemaVersion, fetchPosts, fetchPost, @@ -28,14 +29,18 @@ import Safe import Schema import Version -fetchSchema :: JSM (Either String Schema) -fetchSchema = - A.eitherDecode <$> fetch (fromString "http://localhost:8081/posts.schema.json") +fetchCollections :: JSM (Either String [String]) +fetchCollections = + A.eitherDecode <$> fetch (fromString "http://localhost:8081/collections") fetchSchemaVersion :: JSM (Either String Version) fetchSchemaVersion = A.eitherDecode <$> fetch (fromString "http://localhost:8081/schemaVersion") +fetchSchema :: JSM (Either String Schema) +fetchSchema = + A.eitherDecode <$> fetch (fromString "http://localhost:8081/posts.schema.json") + fetchPosts :: JSM (Either String [A.Value]) fetchPosts = A.eitherDecode |