mod pages; use crate::pages::*; use yew::prelude::*; use yew_router::prelude::*; #[derive(Clone, PartialEq, Routable)] enum Route { #[at("/")] Home, #[at("/ticket")] Ticket, #[at("/tickets/:id")] TicketById { id: i32 }, #[at("/tickets")] AllTickets, #[at("/register")] Register, #[at("/login")] Login, #[at("/users")] AllUsers, #[at("/users/:id")] UserByID { id: i16 }, #[not_found] #[at("/404")] NotFound, } fn switch(route: Route) -> Html { match route { Route::Home => html! { }, Route::NotFound => html! { }, Route::Ticket => html! { }, Route::TicketById { id } => html! { }, Route::AllTickets => html! { }, Route::Register => html! { }, Route::Login => html! { }, Route::AllUsers => html! {}, Route::UserByID { id } => html! { }, } } #[component(App)] pub fn app() -> Html { html! { render={switch} /> } }