Skip to content

[6.15] How to access to Extension in Leptos_Axum #3411

Answered by SoapyDev
SoapyDev asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, sorry for the wait. It seems this example works actually, so I will have to reexamine why my fully fleshed out solution does not. Thanks for your time.

use leptos::*;

#[derive(Clone)]
struct User(&'static str);

#[cfg(feature = "ssr")]
pub mod ssr {
    use super::User;
    use axum::extract::FromRef;
    use axum::extract::Request;
    use axum::http::StatusCode;
    use axum::middleware::Next;
    use axum::response::Response;
    use leptos::LeptosOptions;

    #[derive(Debug, Clone, FromRef)]
    pub struct AppState {
        pub leptos_options: LeptosOptions,
        // Other states ...
    }

    pub(crate) async fn auth(mut request: Request, next: Next) -> Result<Response, St…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@gbj
Comment options

gbj Jan 7, 2025
Maintainer

@SoapyDev
Comment options

Answer selected by SoapyDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants