web permissions2
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
use axum::{
|
||||
extract::{Query, State},
|
||||
http::{HeaderMap, HeaderValue, StatusCode, header},
|
||||
http::{HeaderMap, HeaderValue, StatusCode},
|
||||
response::{Html, IntoResponse, Redirect, Response},
|
||||
};
|
||||
use axum_extra::extract::Form;
|
||||
@@ -107,10 +107,10 @@ pub(crate) async fn create_table(
|
||||
let Ok(location) = HeaderValue::try_from(location) else {
|
||||
return (StatusCode::INTERNAL_SERVER_ERROR, "Invalid redirect").into_response();
|
||||
};
|
||||
let mut response = StatusCode::SEE_OTHER.into_response();
|
||||
response
|
||||
.headers_mut()
|
||||
.insert(header::LOCATION, location.clone());
|
||||
// `hx-redirect` alone, with no body and no 3xx: the form is posted
|
||||
// over XHR, and the browser would follow a `Location` itself,
|
||||
// leaving htmx to swap the whole redirected page into `#builder`.
|
||||
let mut response = Html(String::new()).into_response();
|
||||
response.headers_mut().insert("hx-redirect", location);
|
||||
response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user