remove unnecessary passing of value
This commit is contained in:
@@ -261,13 +261,12 @@ pub mod route {
|
|||||||
state: AppState,
|
state: AppState,
|
||||||
params: Self::UrlParams,
|
params: Self::UrlParams,
|
||||||
value: bool,
|
value: bool,
|
||||||
) -> Result<(crate::Context, AppState, Self::UrlParams, bool), crate::Error>;
|
) -> Result<(crate::Context, AppState, Self::UrlParams), crate::Error>;
|
||||||
|
|
||||||
async fn response(
|
async fn response(
|
||||||
ctx: &crate::Context,
|
ctx: &crate::Context,
|
||||||
state: AppState,
|
state: AppState,
|
||||||
params: Self::UrlParams,
|
params: Self::UrlParams,
|
||||||
value: bool,
|
|
||||||
) -> Result<Response<BoxBody>, crate::Error>;
|
) -> Result<Response<BoxBody>, crate::Error>;
|
||||||
|
|
||||||
async fn on(
|
async fn on(
|
||||||
@@ -275,9 +274,8 @@ pub mod route {
|
|||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
Path(path): Path<Self::UrlParams>,
|
Path(path): Path<Self::UrlParams>,
|
||||||
) -> Result<Response<BoxBody>, crate::Error> {
|
) -> Result<Response<BoxBody>, crate::Error> {
|
||||||
let (ctx, state, params, value) =
|
let (ctx, state, params) = <Self as ToggleHtmx>::set(user, state, path, true).await?;
|
||||||
<Self as ToggleHtmx>::set(user, state, path, true).await?;
|
<Self as ToggleHtmx>::response(&ctx, state, params).await
|
||||||
<Self as ToggleHtmx>::response(&ctx, state, params, value).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn off(
|
async fn off(
|
||||||
@@ -285,9 +283,8 @@ pub mod route {
|
|||||||
State(state): State<AppState>,
|
State(state): State<AppState>,
|
||||||
Path(path): Path<Self::UrlParams>,
|
Path(path): Path<Self::UrlParams>,
|
||||||
) -> Result<Response<BoxBody>, crate::Error> {
|
) -> Result<Response<BoxBody>, crate::Error> {
|
||||||
let (ctx, state, params, value) =
|
let (ctx, state, params) = <Self as ToggleHtmx>::set(user, state, path, false).await?;
|
||||||
<Self as ToggleHtmx>::set(user, state, path, false).await?;
|
<Self as ToggleHtmx>::response(&ctx, state, params).await
|
||||||
<Self as ToggleHtmx>::response(&ctx, state, params, value).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn router<B>() -> axum::Router<AppState, B>
|
fn router<B>() -> axum::Router<AppState, B>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#![allow(unused_variables)]
|
|
||||||
|
|
||||||
pub mod list;
|
pub mod list;
|
||||||
pub use list::List;
|
pub use list::List;
|
||||||
|
|
||||||
@@ -92,7 +90,10 @@ impl crud::Container for Container {
|
|||||||
type Reference = Reference;
|
type Reference = Reference;
|
||||||
|
|
||||||
fn with_id(&self, id: Self::Id) -> Self::Reference {
|
fn with_id(&self, id: Self::Id) -> Self::Reference {
|
||||||
Reference { id, container: *self }
|
Reference {
|
||||||
|
id,
|
||||||
|
container: *self,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,18 +1012,17 @@ impl route::ToggleHtmx for StateUpdate {
|
|||||||
state: AppState,
|
state: AppState,
|
||||||
params: Self::UrlParams,
|
params: Self::UrlParams,
|
||||||
value: bool,
|
value: bool,
|
||||||
) -> Result<(crate::Context, AppState, Self::UrlParams, bool), crate::Error> {
|
) -> Result<(crate::Context, AppState, Self::UrlParams), crate::Error> {
|
||||||
let ctx = Context::build(current_user);
|
let ctx = Context::build(current_user);
|
||||||
<Self as crud::Toggle>::set(&ctx, &state.database_pool, params.into(), value).await?;
|
<Self as crud::Toggle>::set(&ctx, &state.database_pool, params.into(), value).await?;
|
||||||
|
|
||||||
Ok((ctx, state, params, value))
|
Ok((ctx, state, params))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn response(
|
async fn response(
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
state: AppState,
|
state: AppState,
|
||||||
(trip_id, todo_id): Self::UrlParams,
|
(trip_id, todo_id): Self::UrlParams,
|
||||||
value: bool,
|
|
||||||
) -> Result<Response<BoxBody>, crate::Error> {
|
) -> Result<Response<BoxBody>, crate::Error> {
|
||||||
let todo_item = Todo::find(
|
let todo_item = Todo::find(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user