diff options
Diffstat (limited to 'frontend/app/Api.hs')
-rw-r--r-- | frontend/app/Api.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/frontend/app/Api.hs b/frontend/app/Api.hs index 2aa23c9..2b7598a 100644 --- a/frontend/app/Api.hs +++ b/frontend/app/Api.hs @@ -2,6 +2,7 @@ module Api ( fetchCollections, + createCollection, fetchSchema, fetchSchemaVersion, fetchPosts, @@ -33,6 +34,15 @@ fetchCollections :: JSM (Either String [String]) fetchCollections = A.eitherDecode <$> fetch (fromString "http://localhost:8081/collections") +createCollection :: String -> JSM (Either String ()) +createCollection collection = + A.eitherDecode + <$> fetch + ( fromString "http://localhost:8081/collections" + & setRequestMethod "POST" + & setRequestBodyLBS (A.encode (A.toJSON collection)) + ) + fetchSchemaVersion :: JSM (Either String Version) fetchSchemaVersion = A.eitherDecode <$> fetch (fromString "http://localhost:8081/schemaVersion") |