use axum::{http::{HeaderMap, StatusCode}, response::Response}; use crate::utils; pub async fn get( headers: HeaderMap, ) -> Response{ match utils::auth::check_auth(&headers){ Ok(jwt) => { Response::builder() .header("Access-Control-Allow-Origin", "http://127.0.0.1:5173") .header("Access-Control-Allow-Method", "GET") .body(serde_json::to_string(&jwt).unwrap().into()).unwrap() }, Err(_) => { Response::builder() .header("Access-Control-Allow-Origin", "http://127.0.0.1:5173") .header("Access-Control-Allow-Method", "GET") .status(StatusCode::UNAUTHORIZED) .body("".into()) .unwrap() } } }