From 72037dc037c5afa7852b6cce6806a9beb6b41a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kate=C5=99ina=20Churanov=C3=A1?= Date: Fri, 26 Jan 2024 17:25:11 +0100 Subject: [PATCH] feat: make setters nicer to use --- src/config.rs | 15 ++++++--------- yew-oauth2-redirect-example/src/app.rs | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/config.rs b/src/config.rs index e998e85..f6be26e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -49,26 +49,23 @@ pub mod openid { } /// Set an override for the URL for ending the session. - pub fn with_end_session_url(mut self, end_session_url: impl Into>) -> Self { - self.end_session_url = end_session_url.into(); + pub fn with_end_session_url(mut self, end_session_url: impl Into) -> Self { + self.end_session_url = Some(end_session_url.into()); self } /// Set the URL the issuer should redirect to after the logout - pub fn with_after_logout_url( - mut self, - after_logout_url: impl Into>, - ) -> Self { - self.after_logout_url = after_logout_url.into(); + pub fn with_after_logout_url(mut self, after_logout_url: impl Into) -> Self { + self.after_logout_url = Some(after_logout_url.into()); self } /// Set the name of the post logout redirect query parameter pub fn with_post_logout_redirect_name( mut self, - post_logout_redirect_name: impl Into>, + post_logout_redirect_name: impl Into, ) -> Self { - self.post_logout_redirect_name = post_logout_redirect_name.into(); + self.post_logout_redirect_name = Some(post_logout_redirect_name.into()); self } diff --git a/yew-oauth2-redirect-example/src/app.rs b/yew-oauth2-redirect-example/src/app.rs index a89818a..61e5e2b 100644 --- a/yew-oauth2-redirect-example/src/app.rs +++ b/yew-oauth2-redirect-example/src/app.rs @@ -129,7 +129,7 @@ pub fn app() -> Html { back to the current page, which is detected as a new session, and will try to log in again, if the page requires this. */ - .with_after_logout_url(Some("/".into())); + .with_after_logout_url("/"); let mode = if cfg!(feature = "openid") { "OpenID Connect"