Skip to content

Commit

Permalink
update yew to 0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
mh84 authored and ctron committed Oct 2, 2023
1 parent 5d860d1 commit 9c44b61
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["sync"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
yew = "0.20"
yew = "0.21.0"

web-sys = { version = "0.3", features = [
"Window",
] }

openidconnect = { version = "3.0", optional = true }
yew-nested-router = { version = ">=0.2, <0.4", optional = true }
yew-nested-router = { git = "https://github.com/mh84/yew-nested-router", rev = "de83197b27eef473afcf8a77776cd3bd245e2d56", optional = true }

[features]
# Enable for Yew nested router support
Expand Down
6 changes: 3 additions & 3 deletions src/components/redirect/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ impl Redirector for LocationRedirector {
#[derive(Clone, Debug, PartialEq, Properties)]
pub struct LocationProps {
#[prop_or_default]
pub children: Option<Children>,
pub children: Children,

pub logout_href: String,
}

impl RedirectorProperties for LocationProps {
fn children(&self) -> Option<&Children> {
self.children.as_ref()
fn children(&self) -> &Children {
&self.children
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/components/redirect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub trait Redirector: 'static {
}

pub trait RedirectorProperties: yew::Properties {
fn children(&self) -> Option<&Children>;
fn children(&self) -> &Children;
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -104,10 +104,7 @@ where
fn view(&self, ctx: &Context<Self>) -> Html {
match self.auth {
None => missing_context(),
Some(OAuth2Context::Authenticated(..)) => match ctx.props().children() {
Some(children) => html!({for children.iter()}),
None => html!(),
},
Some(OAuth2Context::Authenticated(..)) => html!({for ctx.props().children().iter()}),
_ => html!(),
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/redirect/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ where
R: Target + 'static,
{
#[prop_or_default]
pub children: Option<Children>,
pub children: Children,
pub logout: R,
}

impl<R> RedirectorProperties for RouterProps<R>
where
R: Target + 'static,
{
fn children(&self) -> Option<&Children> {
self.children.as_ref()
fn children(&self) -> &Children {
&self.children
}
}

Expand Down
4 changes: 2 additions & 2 deletions yew-oauth2-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ log = { version = "0.4", features = [] }
serde_json = "1"
wasm-bindgen = "0.2.79"
wasm-logger = "0.2"
yew = { version = "0.20", features = ["csr"] }
yew-nested-router = "0.2.0"
yew = { version = "0.21", features = ["csr"] }
yew-nested-router = { git = "https://github.com/mh84/yew-nested-router", rev = "de83197b27eef473afcf8a77776cd3bd245e2d56" }

openidconnect = { version = "3.0", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions yew-oauth2-redirect-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ log = { version = "0.4", features = [] }
serde_json = "1"
wasm-bindgen = "0.2.79"
wasm-logger = "0.2"
yew = { version = "0.20", features = ["csr"] }
yew-nested-router = "0.2.0"
yew = { version = "0.21.0", features = ["csr"] }
yew-nested-router = { git = "https://github.com/mh84/yew-nested-router", rev = "de83197b27eef473afcf8a77776cd3bd245e2d56" }

openidconnect = { version = "3.0", optional = true }

Expand Down

0 comments on commit 9c44b61

Please sign in to comment.