diff --git a/Cargo.toml b/Cargo.toml index 1964645..4677ca9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ thiserror = "1.0.57" tower-sessions = { version = "0.11", default-features = false } tower-sessions-redis-store = { version = "0.11", optional = true } async-trait = "0.1.79" -axum-login = "0.14.0" +axum-login = { version = "0.14.0", optional = true } [patch.crates-io] gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" } @@ -60,6 +60,7 @@ ssr = [ "tower", "tower-http", "tower-sessions-redis-store", + "axum-login", ] # Defines a size-optimized profile for the WASM bundle in release mode diff --git a/src/auth_backend.rs b/src/auth_backend.rs index 24e3454..79e5d9c 100644 --- a/src/auth_backend.rs +++ b/src/auth_backend.rs @@ -1,15 +1,7 @@ -use cfg_if::cfg_if; - -cfg_if! { - if #[cfg(feature = "ssr")] { - use async_trait::async_trait; - use axum_login::{AuthnBackend, UserId}; - use crate::users::UserCredentials; - use leptos::server_fn::error::ServerFnErrorErr; - } -} - -use axum_login::AuthUser; +use async_trait::async_trait; +use axum_login::{AuthnBackend, AuthUser, UserId}; +use crate::users::UserCredentials; +use leptos::server_fn::error::ServerFnErrorErr; use crate::models::User; diff --git a/src/lib.rs b/src/lib.rs index 581ae74..74b1c08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,11 +12,11 @@ pub mod users; pub mod search; pub mod fileserv; pub mod error_template; -pub mod auth_backend; use cfg_if::cfg_if; cfg_if! { - if #[cfg(feature = "ssr")] { + if #[cfg(feature = "ssr")] { + pub mod auth_backend; pub mod schema; } }