mod app; use app::OSSE; use web_sys::window; use yew::prelude::*; use yew_router::prelude::*; #[derive(Clone, Routable, PartialEq)] enum Route { #[at("/")] OSSEHome, #[at("/search/")] OSSEHomeEmptySearch, #[at("/search/:query")] OSSESearch { query: String }, } fn switch_routes(routes: Route) -> Html { let location = window().unwrap().location(); let api_endpoint = format!( "{}//{}:{}/api", location.protocol().unwrap(), location.hostname().unwrap(), 4444 ); match routes { Route::OSSEHome | Route::OSSEHomeEmptySearch => html! { } /> }, Route::OSSESearch { query } => html! { }, } } #[function_component(App)] fn yew_app() -> Html { html! { <> render={switch_routes} /> } } fn main() { yew::Renderer::::new().render(); }