chore: clear warnings

This commit is contained in:
Greg Johnston 2024-01-08 22:00:07 -05:00
parent be084a5d1d
commit 738eeefe73
6 changed files with 15 additions and 23 deletions

View File

@ -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"] }

View File

@ -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},

View File

@ -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))]
@ -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>();
@ -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?;

View File

@ -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()
@ -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,
@ -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,

View File

@ -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};
@ -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>,
@ -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;

View File

@ -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;
@ -60,7 +60,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()
}