19 lines
521 B
Rust
19 lines
521 B
Rust
use actix_web::{http::header::LOCATION, web, HttpResponse, Responder};
|
|
use sqlx::PgPool;
|
|
|
|
use crate::{endpoints::IdPath, models::User, utils::ApplicationError};
|
|
|
|
|
|
#[actix_web::delete("/locations/delete/{id}")]
|
|
pub async fn delete (
|
|
user: web::ReqData<User>,
|
|
pool: web::Data<PgPool>,
|
|
path: web::Path<IdPath>
|
|
) -> Result<impl Responder, ApplicationError> {
|
|
|
|
Ok(HttpResponse::Found()
|
|
.insert_header((LOCATION, "/locations"))
|
|
.insert_header(("HX-LOCATION", "/locations"))
|
|
.finish())
|
|
}
|