use actix_web::http::header; use actix_web::{cookie, web, HttpResponse}; use crate::WebData; pub async fn log_out(data: web::Data<WebData<'_>>) -> HttpResponse { let mut response = HttpResponse::Found() .append_header((header::LOCATION, "index.html")) .finish(); let mut builder = cookie::Cookie::build("auth", "").path("/"); if data.set_cookie_domain { builder = builder.domain(data.base_domain.to_string()); } if let Err(e) = response.add_removal_cookie(&builder.finish()) { log::error!("Cann't set cookie {}", e); } response }