Browse Source

fix: Use as_value() to properly serialize form values in login example (#3835)

The login form example was trying to directly use FormValue in reqwest's form method, which doesn't implement Serialize. This change extracts the actual string values using as_value() before sending them to the server.
Varun V 2 months ago
parent
commit
487fa25dc8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      examples/login_form.rs

+ 2 - 2
examples/login_form.rs

@@ -17,8 +17,8 @@ fn app() -> Element {
         let resp = reqwest::Client::new()
             .post("http://localhost:8080/login")
             .form(&[
-                ("username", &evt.values()["username"]),
-                ("password", &evt.values()["password"]),
+                ("username", evt.values()["username"].as_value()),
+                ("password", evt.values()["password"].as_value()),
             ])
             .send()
             .await;