diff options
author | colin <colin@cicadas.surf> | 2024-10-28 19:30:15 -0700 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-10-28 19:30:15 -0700 |
commit | 0281b662f1153c0ef8cb34c373aa75b5692a515d (patch) | |
tree | 35b19c2a28829b82af9f9d9178e273d65c884f77 /src | |
parent | b180b49f8c6611878cd40781967d35abf787b423 (diff) |
generate parsed json
Diffstat (limited to 'src')
-rw-r--r-- | src/client/ps/generate.lisp | 22 |
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))))))))) |