depreciate the render macro
This commit is contained in:
1 parent
90d0164b9e
commit
e65c5f0eb3
148 files changed
+459
-458
No files matched your search
@@ -49,7 +49,7 @@ fn App() -> Element {
|
||||
if fermi_auth_request.read().is_none() {
|
||||
*fermi_auth_request.write() = Some(stored_auth_request);
|
||||
}
|
||||
render! { Router::<Route> {} }
|
||||
rsx! { Router::<Route> {} }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn LogOut(cx: Scope<ClientProps>) -> Element {
|
||||
Some(log_out_url_result) => match log_out_url_result {
|
||||
Some(uri) => match uri {
|
||||
Ok(uri) => {
|
||||
render! {
|
||||
rsx! {
|
||||
Link {
|
||||
onclick: move |_| {
|
||||
{
|
||||
@@ -40,11 +40,11 @@ pub fn LogOut(cx: Scope<ClientProps>) -> Element {
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
render! { div { "Failed to load disconnection url: {error:?}" } }
|
||||
rsx! { div { "Failed to load disconnection url: {error:?}" } }
|
||||
}
|
||||
},
|
||||
None => {
|
||||
render! { div { "Loading... Please wait" } }
|
||||
rsx! { div { "Loading... Please wait" } }
|
||||
}
|
||||
},
|
||||
None => {
|
||||
@@ -59,15 +59,15 @@ pub fn LogOut(cx: Scope<ClientProps>) -> Element {
|
||||
})
|
||||
};
|
||||
logout_url_task();
|
||||
render! { div { "Loading log out url... Please wait" } }
|
||||
rsx! { div { "Loading log out url... Please wait" } }
|
||||
}
|
||||
},
|
||||
None => {
|
||||
render! {{}}
|
||||
rsx! {{}}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
render! {{}}
|
||||
rsx! {{}}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -113,14 +113,14 @@ pub fn RefreshToken(cx: Scope<ClientProps>) -> Element {
|
||||
})
|
||||
};
|
||||
exchange_refresh_token_spawn();
|
||||
render! { div { "Refreshing session, please wait" } }
|
||||
rsx! { div { "Refreshing session, please wait" } }
|
||||
}
|
||||
None => {
|
||||
render! { div { "Id token expired and no refresh token found" } }
|
||||
rsx! { div { "Id token expired and no refresh token found" } }
|
||||
}
|
||||
},
|
||||
None => {
|
||||
render! {{}}
|
||||
rsx! {{}}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -135,21 +135,21 @@ pub fn LoadClient() -> Element {
|
||||
*fermi_client.write() = ClientState {
|
||||
oidc_client: Some(ClientProps::new(client_id.clone(), client.clone())),
|
||||
};
|
||||
render! {
|
||||
rsx! {
|
||||
div { "Client successfully loaded" }
|
||||
Outlet::<Route> {}
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
log::info! {"Failed to load client: {:?}", error};
|
||||
render! {
|
||||
rsx! {
|
||||
div { "Failed to load client: {error:?}" }
|
||||
Outlet::<Route> {}
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
render! {
|
||||
rsx! {
|
||||
div {
|
||||
div { "Loading client, please wait" }
|
||||
Outlet::<Route> {}
|
||||
@@ -180,7 +180,7 @@ pub fn AuthHeader() -> Element {
|
||||
auth_request.nonce.clone(),
|
||||
) {
|
||||
Ok(email) => {
|
||||
render! {
|
||||
rsx! {
|
||||
div {
|
||||
div { {email} }
|
||||
LogOut { client_id: client_props.client_id, client: client_props.client }
|
||||
@@ -193,7 +193,7 @@ pub fn AuthHeader() -> Element {
|
||||
// Id token failed to be decoded because it expired, we refresh it
|
||||
openidconnect::ClaimsVerificationError::Expired(_message) => {
|
||||
log::info!("Token expired");
|
||||
render! {
|
||||
rsx! {
|
||||
div {
|
||||
RefreshToken { client_id: client_props.client_id, client: client_props.client }
|
||||
Outlet::<Route> {}
|
||||
@@ -203,7 +203,7 @@ pub fn AuthHeader() -> Element {
|
||||
// Other issue with token decoding
|
||||
_ => {
|
||||
log::info!("Other issue with token");
|
||||
render! {
|
||||
rsx! {
|
||||
div {
|
||||
div { "{error}" }
|
||||
Outlet::<Route> {}
|
||||
@@ -215,7 +215,7 @@ pub fn AuthHeader() -> Element {
|
||||
}
|
||||
// User is not logged in
|
||||
None => {
|
||||
render! {
|
||||
rsx! {
|
||||
div {
|
||||
Link { to: auth_request.authorize_url.clone(), "Log in" }
|
||||
Outlet::<Route> {}
|
||||
@@ -232,17 +232,17 @@ pub fn AuthHeader() -> Element {
|
||||
auth_request: Some(auth_request),
|
||||
}),
|
||||
);
|
||||
render! { div { "Loading nonce" } }
|
||||
rsx! { div { "Loading nonce" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Client is not initialized yet, we need it for everything
|
||||
(None, _, _) => {
|
||||
render! { LoadClient {} }
|
||||
rsx! { LoadClient {} }
|
||||
}
|
||||
// We need everything loaded before doing anything
|
||||
(_client, _auth_request, _auth_token) => {
|
||||
render! {{}}
|
||||
rsx! {{}}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
pub fn Home() -> Element {
|
||||
render! { div { "Hello world" } }
|
||||
rsx! { div { "Hello world" } }
|
||||
}
|
||||
@@ -21,14 +21,14 @@ pub fn Login(query_string: String) -> Element {
|
||||
(Some(client_props), Some(auth_token_read)) => {
|
||||
match (auth_token_read.id_token, auth_token_read.refresh_token) {
|
||||
(Some(_id_token), Some(_refresh_token)) => {
|
||||
render! {
|
||||
rsx! {
|
||||
div { "Sign in successful" }
|
||||
Link { to: home_url, "Go back home" }
|
||||
}
|
||||
}
|
||||
// If the refresh token is set but not the id_token, there was an error, we just go back home and reset their value
|
||||
(None, Some(_)) | (Some(_), None) => {
|
||||
render! {
|
||||
rsx! {
|
||||
div { "Error while attempting to log in" }
|
||||
Link {
|
||||
to: home_url,
|
||||
@@ -70,17 +70,17 @@ pub fn Login(query_string: String) -> Element {
|
||||
})
|
||||
};
|
||||
token_response_spawn();
|
||||
render!{ div {} }
|
||||
rsx!{ div {} }
|
||||
}
|
||||
None => {
|
||||
render! { div { "No code provided" } }
|
||||
rsx! { div { "No code provided" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
(_, _) => {
|
||||
render! {{}}
|
||||
rsx! {{}}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -2,7 +2,7 @@ use dioxus::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn NotFound(route: Vec<String>) -> Element {
|
||||
render! {
|
||||
rsx! {
|
||||
div{
|
||||
{route.join("")}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user