From 0281b662f1153c0ef8cb34c373aa75b5692a515d Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 28 Oct 2024 19:30:15 -0700 Subject: generate parsed json --- src/client/ps/generate.lisp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/client/ps') 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))))))))) -- cgit v1.2.3