Fix latency issue

This commit is contained in:
Michael Mikovsky
2025-12-21 17:58:04 -07:00
parent 78fda07ab2
commit 1d7845e725
15 changed files with 1113 additions and 120 deletions
+12 -12
View File
@@ -58,7 +58,7 @@ pub async fn authorize(mut req: Request, next: Next) -> Result<Response<Body>, A
let (_, token) = (header.next(), header.next());
let token_data: TokenData<Cliams> = match decode_jwt(token.unwrap().to_string()) {
let _token_data: TokenData<Cliams> = match decode_jwt(token.unwrap().to_string()) {
Ok(data) => data,
Err(_) => {
return Err(AuthError {
@@ -68,18 +68,18 @@ pub async fn authorize(mut req: Request, next: Next) -> Result<Response<Body>, A
}
};
// Fetch the user details from the database
let current_user = match retrieve_user_by_email(&token_data.claims.email) {
Some(user) => user,
None => {
return Err(AuthError {
message: "Unauthorized".to_string(),
status_code: StatusCode::UNAUTHORIZED,
});
}
};
// // Fetch the user details from the database
// let current_user = match retrieve_user_by_email(&token_data.claims.email) {
// Some(user) => user,
// None => {
// return Err(AuthError {
// message: "Unauthorized".to_string(),
// status_code: StatusCode::UNAUTHORIZED,
// });
// }
// };
req.extensions_mut().insert(current_user);
// req.extensions_mut().insert(current_user);
Ok(next.run(req).await)
}