Basic yew router working now
This commit is contained in:
parent
a42d8557a8
commit
bd2c70fcfb
1 changed files with 4 additions and 4 deletions
|
@ -11,11 +11,11 @@ struct App {}
|
|||
|
||||
#[derive(Debug, Switch, Clone)]
|
||||
enum AppRoute {
|
||||
#[to = "/"]
|
||||
Root,
|
||||
#[to = "/login"]
|
||||
Login,
|
||||
PageNotFound(Permissive<String>),
|
||||
#[to = "/"]
|
||||
Root,
|
||||
}
|
||||
|
||||
impl Component for App {
|
||||
|
@ -42,11 +42,11 @@ impl Component for App {
|
|||
render = Router::render(|switch: AppRoute| {
|
||||
match switch {
|
||||
AppRoute::Login => html!{<LoginComponent />},
|
||||
AppRoute::PageNotFound(Permissive(None)) => html!{"Page not found"},
|
||||
AppRoute::PageNotFound(Permissive(Some(missed_route))) => html!{format!("Page '{}' not found", missed_route)},
|
||||
AppRoute::Root => {
|
||||
html!{"hello there!"}
|
||||
},
|
||||
AppRoute::PageNotFound(Permissive(None)) => html!{"Page not found"},
|
||||
AppRoute::PageNotFound(Permissive(Some(missed_route))) => html!{format!("Page '{}' not found", missed_route)}
|
||||
}
|
||||
})
|
||||
redirect = Router::redirect(|route: Route| {
|
||||
|
|
Loading…
Reference in a new issue