diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-30 17:13:41 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-30 17:13:49 +0100 |
commit | 85e388455a09e307fea14e4c98ece65c463b7773 (patch) | |
tree | b145443510ab8b2a5688c80744fccfa73f1e2b4a /frontend | |
parent | Frontend: Setup skeleton route support (diff) | |
download | OSSE-85e388455a09e307fea14e4c98ece65c463b7773.tar.gz OSSE-85e388455a09e307fea14e4c98ece65c463b7773.tar.bz2 OSSE-85e388455a09e307fea14e4c98ece65c463b7773.zip |
Frontend: Update yew to follow master
This enables us to use the new Router API
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/Cargo.toml | 5 | ||||
-rw-r--r-- | frontend/src/app.rs | 2 | ||||
-rw-r--r-- | frontend/src/main.rs | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index 7cc9e0b..3730022 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -6,8 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -yew = "0.19" -yew-router = "0.16" +# this is the development version of Yew +yew = { git = "https://github.com/yewstack/yew/", features = ["csr"] } +yew-router = { git = "https://github.com/yewstack/yew.git" } gloo = "0.8.0" web-sys = "0.3.60" wasm-bindgen = "0.2.83" diff --git a/frontend/src/app.rs b/frontend/src/app.rs index a1f63de..d98b955 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -82,7 +82,7 @@ impl Component for OSSE { } fn view(&self, ctx: &Context<Self>) -> Html { - let onsubmit = ctx.link().callback(|event: FocusEvent| { + let onsubmit = ctx.link().callback(|event: SubmitEvent| { event.prevent_default(); OSSEMessage::SearchSubmitted diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 95b52e5..fd5ef3c 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -13,7 +13,7 @@ enum Route { OSSESearch { query: String }, } -fn switch_routes(routes: &Route) -> Html { +fn switch_routes(routes: Route) -> Html { match routes { Route::OSSEHome => html! { <OSSE api_endpoint={"http://127.0.0.1:4444"}/> @@ -29,12 +29,12 @@ fn yew_app() -> Html { html! { <> <BrowserRouter> - <Switch<Route> render={Switch::render(switch_routes)} /> + <Switch<Route> render={switch_routes} /> </BrowserRouter> </> } } fn main() { - yew::start_app::<App>(); + yew::Renderer::<App>::new().render(); } |