add collections
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user