aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/ps/generate.lisp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/client/ps/generate.lisp b/src/client/ps/generate.lisp
index fc6c099..63c7753 100644
--- a/src/client/ps/generate.lisp
+++ b/src/client/ps/generate.lisp
@@ -47,14 +47,20 @@
:when more
:collect "&")))))
`(defun ,(or alt-name (class-name class)) ,args
- (fetch (+ "" ,@parts ,@url-params)
- (ps:create
- method ,(string method)
- cache "no-cache"
- ,@(when (wknd:body-expected-p method)
- `(headers (ps:create "Content-Type" "application/json")))
- redirect "follow"
- ,@(when body (list 'body body)))))))
+ (ps:chain
+ (fetch (+ "" ,@parts ,@url-params)
+ (ps:create
+ method ,(string method)
+ cache "no-cache"
+ ,@(when (wknd:body-expected-p method)
+ `(headers (ps:create "Content-Type" "application/json")))
+ redirect "follow"
+ ,@(when body (list 'body body))))
+ (then
+ (lambda (resp)
+ (and resp
+ (= 200 (ps:@ resp status))
+ (ps:chain resp (json)))))))))