Pages link to each other

This commit is contained in:
2026-05-02 10:41:11 +02:00
parent 6d8fcc6b53
commit 3d1366e704
3 changed files with 26 additions and 14 deletions

View File

@@ -2,7 +2,7 @@ use gloo_net::http::Request;
use serde::{Deserialize, Serialize};
use wasm_bindgen_futures::spawn_local;
use yew::prelude::*;
use yew_router::prelude::use_navigator;
use yew_router::prelude::*;
// #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
// pub struct User {
@@ -298,7 +298,7 @@ pub fn all_users_component() -> Html {
<ul>
{ for users.iter().map(|t| html! {
<li key={t.id.to_string()}>
<h3>{ format!("{} {}- #{}", t.first_name, t.last_name, t.id) }</h3>
<Link<crate::Route> to={crate::Route::UserByID{id: t.id}}><h3>{ format!("{} {}- #{}", t.first_name, t.last_name, t.id) }</h3></Link<crate::Route>>
</li>
})}
</ul>
@@ -576,6 +576,8 @@ pub fn user_by_id_component(props: &UserProps) -> Html {
<button onclick={ondelete} disabled={*deleting}>
{if *deleting {"Löschen..."} else {"Löschen"}}
</button>
<Link<crate::Route> to={crate::Route::AllUsers}>{ "Zurück zur Benutzerübersicht" }</Link<crate::Route>>
if let Some(err) = &*delete_error {
<p style="color:red">{ err.clone() }</p>
}