14 lines
355 B
Rust
14 lines
355 B
Rust
use actix_web::{cookie::Cookie, get, http::StatusCode, HttpResponse, HttpResponseBuilder};
|
|
|
|
#[get("/logout")]
|
|
pub async fn logout() -> HttpResponse {
|
|
let mut auth = Cookie::named("auth");
|
|
|
|
auth.make_removal();
|
|
|
|
HttpResponseBuilder::new(StatusCode::SEE_OTHER)
|
|
.append_header(("Location", "/"))
|
|
.cookie(auth)
|
|
.finish()
|
|
}
|