From bfb98d7675515394e1b9a0417bfafc83d775611c Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Wed, 5 Jun 2024 22:47:49 +0200 Subject: add schema version --- frontend/app/Api.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'frontend/app/Api.hs') diff --git a/frontend/app/Api.hs b/frontend/app/Api.hs index c16e269..f4e4599 100644 --- a/frontend/app/Api.hs +++ b/frontend/app/Api.hs @@ -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 -- cgit v1.2.3