change to accept formdata instead of json
This commit is contained in:
parent
3ba56ca232
commit
d3f829880a
@ -49,13 +49,14 @@ pub async fn get_forms(db: web::Data<Arc<Mutex<Connection>>>) -> impl Responder
|
|||||||
|
|
||||||
// Submit a form
|
// Submit a form
|
||||||
pub async fn submit_form(
|
pub async fn submit_form(
|
||||||
db: web::Data<Arc<Mutex<Connection>>>,
|
db: web::Data<Arc<Mutex<rusqlite::Connection>>>,
|
||||||
path: web::Path<String>,
|
path: web::Path<String>,
|
||||||
submission: web::Json<serde_json::Value>,
|
submission: web::Form<serde_json::Value>,
|
||||||
) -> impl Responder {
|
) -> impl Responder {
|
||||||
let conn = db.lock().unwrap(); // Lock the Mutex to access the database
|
let conn = db.lock().unwrap(); // Lock the Mutex to access the database
|
||||||
let submission_id = Uuid::new_v4().to_string();
|
let submission_id = Uuid::new_v4().to_string();
|
||||||
let form_id = path.into_inner();
|
let form_id = path.into_inner();
|
||||||
|
|
||||||
let submission_json = serde_json::to_string(&submission.into_inner()).unwrap();
|
let submission_json = serde_json::to_string(&submission.into_inner()).unwrap();
|
||||||
|
|
||||||
match conn.execute(
|
match conn.execute(
|
||||||
|
Loading…
Reference in New Issue
Block a user