Profile edit (WIP)

This commit is contained in:
Greg Burri 2024-11-15 14:47:10 +01:00
parent 405aa68526
commit 327b2d0a5b
15 changed files with 174 additions and 46 deletions

View file

@ -16,7 +16,7 @@ use tracing::{event, Level};
use crate::{config::Config, consts, data::db, email, model, utils, AppState};
pub mod ron_api;
pub mod ron;
impl axum::response::IntoResponse for db::DBError {
fn into_response(self) -> Response {
@ -722,12 +722,26 @@ pub async fn reset_password_post(
///// EDIT PROFILE /////
#[derive(Template)]
#[template(path = "profile.html")]
struct ProfileTemplate {
user: Option<model::User>,
}
#[debug_handler]
pub async fn edit_user(
State(connection): State<db::Connection>,
Extension(user): Extension<Option<model::User>>,
) -> Result<impl IntoResponse> {
Ok("todo")
) -> Response {
if user.is_some() {
ProfileTemplate { user }.into_response()
} else {
MessageTemplate {
user: None,
message: "Not logged in",
}
.into_response()
}
}
///// 404 /////