Skip to content

Commit

Permalink
chore: clear warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Jan 9, 2024
1 parent 095769e commit 3bd34f2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/todo_app_sqlite_axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ futures = "0.3"
cfg-if = "1.0"
http = "1.0"
leptos = { path = "../../leptos", features = ["nightly"] }
server_fn = { path = "../../server_fn", features = ["url", "json"] }
server_fn = { path = "../../server_fn", features = ["serde-lite"] }
leptos_axum = { path = "../../integrations/axum", optional = true }
leptos_meta = { path = "../../meta", features = ["nightly"] }
leptos_router = { path = "../../router", features = ["nightly"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/todo_app_sqlite_axum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cfg_if! {
if #[cfg(feature = "ssr")] {
use leptos::*;
use axum::{
routing::{post, get},
routing::get,
extract::{State, Path},
http::Request,
response::{IntoResponse, Response},
Expand Down
6 changes: 3 additions & 3 deletions examples/todo_app_sqlite_axum/src/todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use serde::{Deserialize, Serialize};
use server_fn::codec::SerdeLite;

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
Expand All @@ -26,8 +27,7 @@ cfg_if! {

#[server(GetTodos, "/api")]
pub async fn get_todos() -> Result<Vec<Todo>, ServerFnError> {
use http::{header::SET_COOKIE, request::Parts, HeaderValue, StatusCode};
use leptos_axum::ResponseOptions;
use http::request::Parts;

// this is just an example of how to access server context injected in the handlers
let req_parts = use_context::<Parts>();
Expand Down Expand Up @@ -73,7 +73,7 @@ pub async fn add_todo(title: String) -> Result<(), ServerFnError> {
}

// The struct name and path prefix arguments are optional.
#[server]
#[server(output = SerdeLite)]
pub async fn delete_todo(id: u16) -> Result<(), ServerFnError> {
let mut conn = db().await?;

Expand Down
6 changes: 3 additions & 3 deletions integrations/axum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ where
let path = req.uri().path_and_query().unwrap().as_str();

let full_path = format!("http://leptos.dev{path}");
let (req, req_parts) = generate_request_and_parts(req);
let (_, req_parts) = generate_request_and_parts(req);
move || {
provide_contexts(full_path, req_parts, default_res_options);
app_fn().into_view()
Expand Down Expand Up @@ -998,7 +998,7 @@ where
spawn_task!(async move {
let app = {
let full_path = full_path.clone();
let (req, req_parts) = generate_request_and_parts(req);
let (_, req_parts) = generate_request_and_parts(req);
move || {
provide_contexts(
full_path,
Expand Down Expand Up @@ -1128,7 +1128,7 @@ where
spawn_task!(async move {
let app = {
let full_path = full_path.clone();
let (req, req_parts) = generate_request_and_parts(req);
let (_, req_parts) = generate_request_and_parts(req);
move || {
provide_contexts(
full_path,
Expand Down
16 changes: 3 additions & 13 deletions router/src/components/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ use crate::{
use leptos::{
html::form,
logging::*,
server_fn::{
client::Client,
codec::{Encoding, PostUrl},
redirect::RedirectHook,
request::ClientReq,
ServerFn,
},
server_fn::{client::Client, codec::PostUrl, request::ClientReq, ServerFn},
*,
};
use send_wrapper::SendWrapper;
use serde::{de::DeserializeOwned, Serialize};
use serde::de::DeserializeOwned;
use std::{error::Error, fmt::Debug, rc::Rc};
use thiserror::Error;
use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
Expand Down Expand Up @@ -447,8 +440,7 @@ pub fn ActionForm<ServFn>(
children: Children,
) -> impl IntoView
where
ServFn:
Clone + DeserializeOwned + ServerFn<InputEncoding = PostUrl> + 'static,
ServFn: DeserializeOwned + ServerFn<InputEncoding = PostUrl> + 'static,
<<ServFn::Client as Client<ServFn::Error>>::Request as ClientReq<
ServFn::Error,
>>::FormData: From<FormData>,
Expand All @@ -470,12 +462,10 @@ where
};
let version = action.version();
let value = action.value();
let input = action.input();

let class = class.map(|bx| bx.into_attribute_boxed());

let on_submit = {
let action_url = action_url.clone();
move |ev: SubmitEvent| {
if ev.default_prevented() {
return;
Expand Down
6 changes: 4 additions & 2 deletions router/src/components/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
#[cfg(not(feature = "ssr"))]
use crate::{unescape, Url};
use cfg_if::cfg_if;
use leptos::{server_fn::redirect::RedirectHook, *};
use leptos::{logging::debug_warn, server_fn::redirect::RedirectHook, *};
#[cfg(feature = "transition")]
use leptos_reactive::use_transition;
use send_wrapper::SendWrapper;
Expand Down Expand Up @@ -54,7 +54,9 @@ pub fn Router(
}
});
}) as RedirectHook;
server_fn::redirect::set_redirect_hook(router_hook);
if server_fn::redirect::set_redirect_hook(router_hook).is_err() {
debug_warn!("Error setting <Router/> server function redirect hook.");
}

children()
}
Expand Down

0 comments on commit 3bd34f2

Please sign in to comment.