yew_oauth2/components/
authenticated.rs1use super::missing_context;
4use crate::context::OAuth2Context;
5use yew::prelude::*;
6
7#[derive(Clone, Debug, PartialEq, Properties)]
9pub struct AuthenticatedProperties {
10 pub children: Children,
12}
13
14#[function_component(Authenticated)]
16pub fn authenticated(props: &AuthenticatedProperties) -> Html {
17 let auth = use_context::<OAuth2Context>();
18
19 html!(
20 if let Some(auth) = auth {
21 if let OAuth2Context::Authenticated{..} = auth {
22 { for props.children.iter() }
23 }
24 } else {
25 { missing_context() }
26 }
27 )
28}