This commit is contained in:
LinlyBoi
2022-12-26 23:40:52 +02:00
parent dd4685d8ae
commit 7615b24e8f

View File

@@ -65,7 +65,15 @@ async fn api_json_driver(id: web::Path<i32>) -> Json<CommonDriver> {
} }
#[get("api/json/tickets/{driver}")] #[get("api/json/tickets/{driver}")]
async fn api_json_driver_tickets(id: web::Path<i32>) -> Json<Vec<CommonTicket>> { async fn api_json_driver_tickets(id: web::Path<i32>) -> impl Responder {
let fetched_tickets = get_tickets(&mut establish_connection(), *id); let fetched_tickets = get_tickets(&mut establish_connection(), *id);
Json(fetched_tickets) HttpResponse::Ok()
.content_type(ContentType::json())
.insert_header(("Access-Control-Allow-Origin", "*"))
.insert_header(("content-encoded", "gzip"))
.insert_header((
"Access-Control-Allow-Headers",
"Content-Type, Content-Length, User-Agent, X-Requested-With, Range, DNT ",
))
.json(fetched_tickets)
} }