fix: lint issues in errors_axum example (#988)

This commit is contained in:
agilarity 2023-05-05 11:23:59 -04:00 committed by GitHub
parent 9a6b1f53da
commit b4996769c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,5 @@
extend = [{ path = "../cargo-make/common.toml" }]
[tasks.build] [tasks.build]
command = "cargo" command = "cargo"
args = ["+nightly", "build-all-features"] args = ["+nightly", "build-all-features"]

View file

@ -1,7 +1,4 @@
use crate::{ use crate::{error_template::ErrorTemplate, errors::AppError};
error_template::{ErrorTemplate, ErrorTemplateProps},
errors::AppError,
};
use leptos::*; use leptos::*;
use leptos_meta::*; use leptos_meta::*;
use leptos_router::*; use leptos_router::*;
@ -54,7 +51,8 @@ pub fn App(cx: Scope) -> impl IntoView {
#[component] #[component]
pub fn ExampleErrors(cx: Scope) -> impl IntoView { pub fn ExampleErrors(cx: Scope) -> impl IntoView {
let generate_internal_error = create_server_action::<CauseInternalServerError>(cx); let generate_internal_error =
create_server_action::<CauseInternalServerError>(cx);
view! { cx, view! { cx,
<p> <p>

View file

@ -1,5 +1,4 @@
use cfg_if::cfg_if; use cfg_if::cfg_if;
use leptos::*;
pub mod error_template; pub mod error_template;
pub mod errors; pub mod errors;
pub mod fallback; pub mod fallback;
@ -8,6 +7,7 @@ pub mod landing;
// Needs to be in lib.rs AFAIK because wasm-bindgen needs us to be compiling a lib. I may be wrong. // Needs to be in lib.rs AFAIK because wasm-bindgen needs us to be compiling a lib. I may be wrong.
cfg_if! { cfg_if! {
if #[cfg(feature = "hydrate")] { if #[cfg(feature = "hydrate")] {
use leptos::*;
use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::prelude::wasm_bindgen;
use crate::landing::*; use crate::landing::*;

View file

@ -37,7 +37,8 @@ async fn custom_handler(
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
simple_logger::init_with_level(log::Level::Debug).expect("couldn't initialize logging"); simple_logger::init_with_level(log::Level::Debug)
.expect("couldn't initialize logging");
crate::landing::register_server_functions(); crate::landing::register_server_functions();
@ -51,7 +52,11 @@ async fn main() {
let app = Router::new() let app = Router::new()
.route("/api/*fn_name", post(leptos_axum::handle_server_fns)) .route("/api/*fn_name", post(leptos_axum::handle_server_fns))
.route("/special/:id", get(custom_handler)) .route("/special/:id", get(custom_handler))
.leptos_routes(leptos_options.clone(), routes, |cx| view! { cx, <App/> }) .leptos_routes(
leptos_options.clone(),
routes,
|cx| view! { cx, <App/> },
)
.fallback(file_and_error_handler) .fallback(file_and_error_handler)
.layer(Extension(Arc::new(leptos_options))); .layer(Extension(Arc::new(leptos_options)));