diff options
author | colin <colin@cicadas.surf> | 2023-01-25 18:26:18 -0800 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2023-01-25 18:26:18 -0800 |
commit | b4cd3bb5cba1551ee85b66716deb2f26722b1ef8 (patch) | |
tree | 55b1c9ac3c34263ca76d07d9870a890260de4027 /endpoints.lisp | |
parent | 59ae4f81e108eef2a1997f42f5b210e79e3d328a (diff) |
Add: initial flash function; modified endpoints to use it
This is untested. Just commiting to share.
Diffstat (limited to 'endpoints.lisp')
-rw-r--r-- | endpoints.lisp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/endpoints.lisp b/endpoints.lisp index e947562..ff6f97c 100644 --- a/endpoints.lisp +++ b/endpoints.lisp @@ -38,18 +38,21 @@ I.e. It should be called within the scope of a request handler." (defendpoint* :get "/" () () (redirect-to "/tavern-door")) -(defendpoint* :get "/tavern-door" ((name str)) () - (if name (doorkeeper :message (format nil "M'fraid I've n'er 'eard o' ~a." name)) - (doorkeeper))) +(defendpoint* :get "/tavern-door" () () + (a:if-let (name (flashed-value)) + (doorkeeper :message (format nil "M'fraid I've n'er 'eard o' ~a." name)) + (doorkeeper))) (defendpoint* :post "/tavern-door" () () (with-plist ((name :name)) (lzb:request-body) (a:if-let ((hero (hero-known-as name))) (a:when-let ((sesh (new-sesh hero))) (lzb:set-response-cookie +session-cookie-name+ (session-id sesh) - :path "/" :domain "localhost") + :path "/" :domain "localhost") ; TODO: generalize domain (redirect-to "/tavern")) - (redirect-to (format nil "/tavern-door?name=~a" (quri:url-encode name)))))) + (progn + (flash name) + (redirect-to (format nil "/tavern-door")))))) (defendpoint* :get "/godess-shrine" () () (godess-shrine)) |