Merge branch '40-reduce-dependencies-and-their-features' into 'main'
Reduce dependencies and their features Closes #40 See merge request libretunes/libretunes!27
This commit is contained in:
@ -1,10 +1,17 @@
|
||||
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;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "ssr")] {
|
||||
use async_trait::async_trait;
|
||||
}
|
||||
}
|
||||
|
||||
impl AuthUser for User {
|
||||
type Id = i32;
|
||||
|
||||
|
19
src/main.rs
19
src/main.rs
@ -19,7 +19,7 @@ async fn main() {
|
||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
use libretunes::app::*;
|
||||
use libretunes::fileserv::{file_and_error_handler, get_static_file};
|
||||
use tower_sessions::SessionManagerLayer;
|
||||
use axum_login::tower_sessions::SessionManagerLayer;
|
||||
use tower_sessions_redis_store::{fred::prelude::*, RedisStore};
|
||||
use axum_login::AuthManagerLayerBuilder;
|
||||
use libretunes::auth_backend::AuthBackend;
|
||||
@ -72,24 +72,9 @@ async fn main() {
|
||||
axum::serve(listener, app.into_make_service()).await.expect("Server failed");
|
||||
}
|
||||
|
||||
#[cfg(not(any(feature = "ssr", feature = "csr")))]
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
pub fn main() {
|
||||
// no client-side main function
|
||||
// unless we want this to work with e.g., Trunk for pure client-side testing
|
||||
// see lib.rs for hydration function instead
|
||||
// see optional feature `csr` instead
|
||||
}
|
||||
|
||||
#[cfg(all(not(feature = "ssr"), feature = "csr"))]
|
||||
pub fn main() {
|
||||
// a client-side main function is required for using `trunk serve`
|
||||
// prefer using `cargo leptos serve` instead
|
||||
// to run: `trunk serve --open --features csr`
|
||||
use leptos::*;
|
||||
use libretunes::app::*;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
leptos::mount_to_body(App);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ pub async fn search(query: String, limit: i64) -> Result<(Vec<Album>, Vec<Artist
|
||||
let artists = search_artists(query.clone(), limit);
|
||||
let songs = search_songs(query.clone(), limit);
|
||||
|
||||
use futures::join;
|
||||
use tokio::join;
|
||||
|
||||
let (albums, artists, songs) = join!(albums, artists, songs);
|
||||
Ok((albums?, artists?, songs?))
|
||||
|
Reference in New Issue
Block a user