aboutsummaryrefslogtreecommitdiffstats
path: root/backend/lib/ACMS/API/REST
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/ACMS/API/REST')
-rw-r--r--backend/lib/ACMS/API/REST/Collection.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/backend/lib/ACMS/API/REST/Collection.hs b/backend/lib/ACMS/API/REST/Collection.hs
index 3ca8ffd..b3faf19 100644
--- a/backend/lib/ACMS/API/REST/Collection.hs
+++ b/backend/lib/ACMS/API/REST/Collection.hs
@@ -11,12 +11,10 @@ import Data.Maybe
import JavaScript.Web.XMLHttpRequest
import Miso.String qualified as J
#endif
-import Collection
import ACMS.API.REST (APIMonad, fetch, restRequest)
+import Collection
import Data.Aeson qualified as A
import Data.Function ((&))
-import Debug.Trace
-import Miso.String (MisoString)
import Text.Printf (printf)
list :: (APIMonad m) => Collection -> m [A.Object]
@@ -25,7 +23,7 @@ list c =
& fetch
>>= A.throwDecode
-read :: (APIMonad m) => CollectionItem -> m [A.Object]
+read :: (APIMonad m) => CollectionItem -> m (Maybe A.Object)
read ci =
restRequest (printf "/collection/%s/%s" ci.collection.name ci.itemFileName)
& fetch
@@ -47,7 +45,7 @@ create c o = do
& fetch
>>= A.throwDecode
-delete :: (APIMonad m) => CollectionItem -> m [A.Object]
+delete :: (APIMonad m) => CollectionItem -> m A.Object
delete ci =
restRequest (printf "/collection/%s/%s" ci.collection.name ci.itemFileName)
& setRequestMethod "DELETE"