Make axum-login crate optional

This commit is contained in:
Ethan Girouard 2024-04-11 17:54:17 -04:00
parent a659564c91
commit 90d645a151
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
3 changed files with 8 additions and 15 deletions

View File

@ -35,7 +35,7 @@ thiserror = "1.0.57"
tower-sessions = { version = "0.11", default-features = false } tower-sessions = { version = "0.11", default-features = false }
tower-sessions-redis-store = { version = "0.11", optional = true } tower-sessions-redis-store = { version = "0.11", optional = true }
async-trait = "0.1.79" async-trait = "0.1.79"
axum-login = "0.14.0" axum-login = { version = "0.14.0", optional = true }
[patch.crates-io] [patch.crates-io]
gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" } gloo-net = { git = "https://github.com/rustwasm/gloo.git", rev = "a823fab7ecc4068e9a28bd669da5eaf3f0a56380" }
@ -60,6 +60,7 @@ ssr = [
"tower", "tower",
"tower-http", "tower-http",
"tower-sessions-redis-store", "tower-sessions-redis-store",
"axum-login",
] ]
# Defines a size-optimized profile for the WASM bundle in release mode # Defines a size-optimized profile for the WASM bundle in release mode

View File

@ -1,15 +1,7 @@
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "ssr")] {
use async_trait::async_trait; use async_trait::async_trait;
use axum_login::{AuthnBackend, UserId}; use axum_login::{AuthnBackend, AuthUser, UserId};
use crate::users::UserCredentials; use crate::users::UserCredentials;
use leptos::server_fn::error::ServerFnErrorErr; use leptos::server_fn::error::ServerFnErrorErr;
}
}
use axum_login::AuthUser;
use crate::models::User; use crate::models::User;

View File

@ -12,11 +12,11 @@ pub mod users;
pub mod search; pub mod search;
pub mod fileserv; pub mod fileserv;
pub mod error_template; pub mod error_template;
pub mod auth_backend;
use cfg_if::cfg_if; use cfg_if::cfg_if;
cfg_if! { cfg_if! {
if #[cfg(feature = "ssr")] { if #[cfg(feature = "ssr")] {
pub mod auth_backend;
pub mod schema; pub mod schema;
} }
} }