Improved logging, UI tweaks.
This commit is contained in:
@@ -14,6 +14,7 @@ cfg_if! { if #[cfg(feature = "ssr")] {
|
||||
use std::str::FromStr;
|
||||
use std::collections::HashMap;
|
||||
use log::warn;
|
||||
use log::info;
|
||||
use crate::backend::data::{ReservationSum, ReservationState, ResWithProperty, Customer, Message, MessageType, ChartData, ResAllView};
|
||||
use crate::backend::get_pool;
|
||||
use crate::backend::get_mailing;
|
||||
@@ -239,6 +240,8 @@ pub async fn get_public_form_data(day: NaiveDate) -> Result<ApiResponse<Vec<Publ
|
||||
let props = get_props(Some("active = true".to_string())).await?;
|
||||
let reservations = reservations_for_day(&day).await?;
|
||||
|
||||
info!("Loading public form data");
|
||||
|
||||
Ok(ApiResponse::Data(props.into_iter().map(|p| PublicFormData {
|
||||
property: p,
|
||||
hours: hours.clone(),
|
||||
@@ -344,6 +347,8 @@ pub async fn create_reservation(reservation: CrReservation, pow: String) -> Resu
|
||||
warn!("Notification not send: {}", e);
|
||||
}
|
||||
|
||||
info!("Reservation created");
|
||||
|
||||
Ok(ApiResponse::Data(reservation.date()))
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,8 @@ pub async fn logout() -> Result<(), ServerFnError> {
|
||||
let session = extract::<Session>().await?;
|
||||
session.clear();
|
||||
|
||||
info!("User logged out");
|
||||
|
||||
redirect("/login");
|
||||
Ok(())
|
||||
}
|
||||
@@ -150,6 +152,7 @@ pub async fn admin_check() -> Result<bool, ServerFnError> {
|
||||
|
||||
#[server]
|
||||
pub async fn get_user() -> Result<Option<User>, ServerFnError> {
|
||||
info!("Get user");
|
||||
Ok(logged_in_user().await)
|
||||
}
|
||||
|
||||
@@ -231,6 +234,8 @@ pub async fn change_pwd(new_pw: PwdChange) -> Result<ApiResponse<()>, ServerFnEr
|
||||
.execute(&pool)
|
||||
.await?;
|
||||
|
||||
info!("Password changed for user: {}", new_pw.login());
|
||||
|
||||
Ok(ApiResponse::Data(()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user