Add endpoint to get current user

This commit is contained in:
2026-06-29 19:31:04 -04:00
parent 280d63ed71
commit b0d5c45caf
2 changed files with 8 additions and 1 deletions

View File

@@ -80,3 +80,9 @@ pub async fn logout() -> Result<()> {
}
.err_context("Error logging out")
}
/// Retrieve the currently logged-in user, or `None` if unauthenticated
#[get("/api/v1/auth/user", auth: Extension<AuthSession>)]
pub async fn get_user() -> Result<Option<User>> {
Ok(auth.user.clone().map(Into::into))
}