add: change default avatar
This commit is contained in:
parent
8dfd307919
commit
959a125992
6 changed files with 92 additions and 13 deletions
|
@ -1,6 +1,9 @@
|
|||
use super::render_error;
|
||||
use crate::{assets::initial_context, get_lang, get_user_from_token, State};
|
||||
use crate::{
|
||||
assets::initial_context, get_lang, get_user_from_token, State, routes::pages::PaginatedQuery,
|
||||
};
|
||||
use axum::{
|
||||
extract::Query,
|
||||
response::{Html, IntoResponse},
|
||||
Extension,
|
||||
};
|
||||
|
@ -11,6 +14,7 @@ use tetratto_core::model::Error;
|
|||
pub async fn seller_settings_request(
|
||||
jar: CookieJar,
|
||||
Extension(data): Extension<State>,
|
||||
Query(props): Query<PaginatedQuery>,
|
||||
) -> impl IntoResponse {
|
||||
let data = data.read().await;
|
||||
let user = match get_user_from_token!(jar, data.0) {
|
||||
|
@ -22,14 +26,16 @@ pub async fn seller_settings_request(
|
|||
}
|
||||
};
|
||||
|
||||
let products = match data.0.get_products_by_user(user.id).await {
|
||||
let products = match data.0.get_products_by_user(user.id, 12, props.page).await {
|
||||
Ok(x) => x,
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &None).await)),
|
||||
};
|
||||
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await;
|
||||
|
||||
context.insert("list", &products);
|
||||
context.insert("page", &props.page);
|
||||
|
||||
// return
|
||||
Ok(Html(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue