blob: f2642a56345be8c6f8862f9fb165cc612cf2c51d (
plain) (
tree)
|
|
use actix_session::Session;
use actix_web::{get, web, HttpResponse};
use uuid::Uuid;
use crate::templates;
use crate::{Pinussy, Result};
#[get("/")]
async fn get(session: Session, state: web::Data<Pinussy>) -> Result<HttpResponse> {
let username: Option<String>;
if let Some(user_id) = session.get::<Uuid>("user_id")? {
username = Some(state.db.users().read(user_id).await?.username)
} else {
username = None
}
return Ok(HttpResponse::Ok().body(render!(templates::home_html, username).unwrap()));
}
|