Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login_form example doesn't work #3783

Open
webhype opened this issue Feb 21, 2025 · 1 comment
Open

login_form example doesn't work #3783

webhype opened this issue Feb 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@webhype
Copy link

webhype commented Feb 21, 2025

Problem

The example login_form fails to compile.

Steps to reproduce the behavior:

$ dx serve --example login_form --platform web --features="http"
08:45:47 [cargo] error[E0277]: the trait bound `FormValue: serde::ser::Serialize` is not satisfied
   --> examples/login_form.rs:19:19
    |
19  |               .form(&[
    |  ______________----_^
    | |              |
    | |              required by a bound introduced by this call
20  | |                 ("username", &evt.values()["username"]),
21  | |                 ("password", &evt.values()["password"]),
22  | |             ])
    | |_____________^ the trait `serde::ser::Serialize` is not implemented for `FormValue`, which is required by `[(&str, &FormValue); 2]: serde::ser::Serialize`
    |
    = note: for local types consider adding `#[derive(serde::Serialize)]` to your `FormValue` type

Expected behavior

That it compile and execute as expected. Lack of working and complete examples and tutorials is really Dioxus' Achilles heel. Hard to estimate the number of devs that want to give this a try but quietly fail and give up. I know it's a huge complex project but I can't overemphasize how frustrating such things are. This is your calling card, your storefront, the place that's supposed to be welcoming to new adopters. So it can't ever be an afterthought, it has to be at the forefront. End of unsolicited advice... 🤣

Environment:

  • Dioxus version: 0.6.3
  • Rust version: rustc 1.83.0
  • OS info: MacOS 15.2
  • App platform: desktop

Questionnaire

I'm interested in fixing this myself but don't know where to start.

@webhype webhype added the bug Something isn't working label Feb 21, 2025
@webhype
Copy link
Author

webhype commented Feb 21, 2025

		let mut form_data = HashMap::new();
		form_data.insert("username", evt.values()["username"].as_value().to_string());
		form_data.insert("password", evt.values()["password"].as_value().to_string());
		let resp = reqwest::Client::new()
			.post("http://localhost:8080/login")
			.form(&form_data)
			.send()
			.await;

This seems to compile; haven't tested it but at least compiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant