From 3add980b73b1ac75d1ad1dde85f6c782439914be Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 6 Jun 2024 22:52:33 +0200 Subject: list collections --- frontend/app/Api.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'frontend/app/Api.hs') 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 -- cgit v1.2.3