aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Api.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 22:52:33 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 22:52:33 +0200
commit3add980b73b1ac75d1ad1dde85f6c782439914be (patch)
tree3d167665b588d3488511e25828a6435c98ec8f9a /frontend/app/Api.hs
parentb1a4822d5954fe02b82f2c525403c74b3920befe (diff)
list collections
Diffstat (limited to 'frontend/app/Api.hs')
-rw-r--r--frontend/app/Api.hs13
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