diff options
Diffstat (limited to '')
-rw-r--r-- | src/routes/home.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/routes/home.rs b/src/routes/home.rs index 11d3a72..a43eabc 100644 --- a/src/routes/home.rs +++ b/src/routes/home.rs @@ -8,12 +8,7 @@ use crate::{Pinussy, Result}; async fn get(session: Session, state: web::Data<Pinussy>) -> Result<HttpResponse> { let username: Option<String>; if let Some(user_id) = session.get::<i32>("user_id")? { - username = Some( - sqlx::query!("select username from users where id = $1", user_id) - .fetch_one(&state.db) - .await? - .username, - ) + username = Some(state.db.users().read(user_id).await?.username) } else { username = None } |