diff options
Diffstat (limited to 'dynamic/capabilities/rsvp.scm')
| -rw-r--r-- | dynamic/capabilities/rsvp.scm | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/dynamic/capabilities/rsvp.scm b/dynamic/capabilities/rsvp.scm index 527f7a1..4ac2eff 100644 --- a/dynamic/capabilities/rsvp.scm +++ b/dynamic/capabilities/rsvp.scm @@ -102,12 +102,12 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." "Handler for RSVP'ing to an event." (let ((params (params->rsvp-create params))) (cond ((not params) - (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid form data"))))) ((not (valid-invite-code (rsvp-create-code params))) - (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid invitation code"))))) @@ -123,8 +123,7 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." (rsvp-create-email params) (rsvp-create-attending params) (rsvp-create-guests params))) - (values '((content-type . (application/json)) - (Access-Control-Allow-Origin . "*")) + (values '((content-type . (application/json))) (scm->json-string `((receipt . ,receipt-code))))))))) @@ -160,12 +159,12 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." "Handler for updating an RSVP to an event." (let ((params (params->rsvp-update params))) (cond ((not params) - (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid form data"))))) ((not (valid-receipt-code (rsvp-update-code params))) - (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid receipt code"))))) @@ -189,7 +188,7 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." (let* ((params (json-string->scm (utf8->string body)))) (cond ((assoc-ref params "id") (create-new-event-rsvp params)) ((assoc-ref params "update") (update-event-rsvp params)) - (else (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (else (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid invite/update code")))))))) @@ -217,8 +216,7 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." (rsvps (exec-query conn "SELECT fullname, email, attending, guests FROM rsvps WHERE event_id = $1" (list (car invitation))))) (match (car event) ((i_ title description date location) - (values '((content-type . (application/json)) - (Access-Control-Allow-Origin . "*")) + (values '((content-type . (application/json))) (scm->json-string `((title . ,title) (description . ,description) @@ -245,8 +243,7 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." (rsvps (exec-query conn "SELECT fullname, email, attending, guests FROM rsvps WHERE event_id = $1" (list (car invitation))))) (match (car event) ((i_ title description date location) - (values '((content-type . (application/json)) - (Access-Control-Allow-Origin . "*")) + (values '((content-type . (application/json))) (scm->json-string `((title . ,title) (description . ,description) @@ -274,7 +271,7 @@ It is a base64 string, encoding `%vanity-length' bytes of randomness." ((and invitation-code (valid-invite-code (car invitation-code))) (get-event-invitation (car invitation-code))) (else - (values (build-response #:code 400 #:headers '((Access-Control-Allow-Origin . "*"))) + (values (build-response #:code 400) (scm->json-string `((success . #f) (error . "Invalid invitation or receipt code")))))))) |