add: profile is_verified
add: better profile not found page TODO: use error page for fallback service
This commit is contained in:
parent
7d96a3d20f
commit
5cfca49793
13 changed files with 234 additions and 20 deletions
|
@ -3,6 +3,14 @@ pub mod misc;
|
|||
pub mod profile;
|
||||
|
||||
use axum::{Router, routing::get};
|
||||
use axum_extra::extract::CookieJar;
|
||||
use serde::Deserialize;
|
||||
use tetratto_core::{
|
||||
DataManager,
|
||||
model::{Error, auth::User},
|
||||
};
|
||||
|
||||
use crate::{assets::initial_context, get_lang};
|
||||
|
||||
pub fn routes() -> Router {
|
||||
Router::new()
|
||||
|
@ -14,3 +22,21 @@ pub fn routes() -> Router {
|
|||
// profile
|
||||
.route("/user/{username}", get(profile::posts_request))
|
||||
}
|
||||
|
||||
pub fn render_error(
|
||||
e: Error,
|
||||
jar: &CookieJar,
|
||||
data: &(DataManager, tera::Tera),
|
||||
user: &Option<User>,
|
||||
) -> String {
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0, lang, &user);
|
||||
context.insert("error_text", &e.to_string());
|
||||
data.1.render("misc/error.html", &mut context).unwrap()
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct PaginatedQuery {
|
||||
#[serde(default)]
|
||||
pub page: usize,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue