From d3f829880a3661f6c33806da6851c8157041061f Mon Sep 17 00:00:00 2001 From: Mohamad Date: Mon, 30 Dec 2024 13:01:55 +0100 Subject: [PATCH] change to accept formdata instead of json --- backend/src/handlers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/handlers.rs b/backend/src/handlers.rs index 805c99d..4d03648 100644 --- a/backend/src/handlers.rs +++ b/backend/src/handlers.rs @@ -49,13 +49,14 @@ pub async fn get_forms(db: web::Data>>) -> impl Responder // Submit a form pub async fn submit_form( - db: web::Data>>, + db: web::Data>>, path: web::Path, - submission: web::Json, + submission: web::Form, ) -> impl Responder { let conn = db.lock().unwrap(); // Lock the Mutex to access the database let submission_id = Uuid::new_v4().to_string(); let form_id = path.into_inner(); + let submission_json = serde_json::to_string(&submission.into_inner()).unwrap(); match conn.execute(