add schema version

This commit is contained in:
Alexander Foremny
2024-06-05 22:47:49 +02:00
parent 2064b4e776
commit bfb98d7675
11 changed files with 252 additions and 51 deletions

View File

@@ -2,6 +2,7 @@
module Api
( fetchSchema,
fetchSchemaVersion,
fetchPosts,
fetchPost,
updatePost,
@@ -25,11 +26,16 @@ import Data.Function
import Miso
import Safe
import Schema
import Version
fetchSchema :: JSM (Either String Schema)
fetchSchema =
A.eitherDecode <$> fetch (fromString "http://localhost:8081/posts.schema.json")
fetchSchemaVersion :: JSM (Either String Version)
fetchSchemaVersion =
A.eitherDecode <$> fetch (fromString "http://localhost:8081/schemaVersion")
fetchPosts :: JSM (Either String [A.Value])
fetchPosts =
A.eitherDecode