app,server: Implement selection of household

This commit is contained in:
traxys 2023-05-29 15:35:30 +02:00
parent dd266dccfd
commit 1eb815ada9
8 changed files with 284 additions and 34 deletions

View file

@ -5,7 +5,11 @@ use axum::{
async_trait,
extract::{FromRef, FromRequestParts, State},
headers::{authorization::Bearer, Authorization},
http::{header::CONTENT_TYPE, request::Parts, HeaderValue, Method, StatusCode},
http::{
header::{AUTHORIZATION, CONTENT_TYPE},
request::Parts,
HeaderValue, Method, StatusCode,
},
response::IntoResponse,
routing::{get, post, put},
Json, Router, TypedHeader,
@ -141,7 +145,7 @@ pub(crate) fn router(api_allowed: Option<HeaderValue>) -> Router<AppState> {
};
let cors_base = CorsLayer::new()
.allow_headers([CONTENT_TYPE])
.allow_headers([CONTENT_TYPE, AUTHORIZATION])
.allow_origin(origin);
let mk_service = |m: Vec<Method>| cors_base.clone().allow_methods(m);