this repo has no description
at main 24 lines 689 B view raw
1use axum::{http::{HeaderMap, StatusCode}, response::Response}; 2 3use crate::utils; 4 5pub async fn get( 6 headers: HeaderMap, 7) -> Response{ 8 match utils::auth::check_auth(&headers){ 9 Ok(jwt) => { 10 Response::builder() 11 .header("Access-Control-Allow-Origin", "http://127.0.0.1:5173") 12 .header("Access-Control-Allow-Method", "GET") 13 .body(serde_json::to_string(&jwt).unwrap().into()).unwrap() 14 }, 15 Err(_) => { 16 Response::builder() 17 .header("Access-Control-Allow-Origin", "http://127.0.0.1:5173") 18 .header("Access-Control-Allow-Method", "GET") 19 .status(StatusCode::UNAUTHORIZED) 20 .body("".into()) 21 .unwrap() 22 } 23 } 24}