rust-api-template/src/api/routes/auth/handlers/logout_post.rs

22 lines
501 B
Rust
Raw Normal View History

2025-04-05 17:10:55 +00:00
use axum::debug_handler;
use crate::{
api::{description::AUTH_TAG, routes::AuthBackendType},
errors::ApiError,
};
#[debug_handler]
#[utoipa::path(
post,
path = "/logout",
summary = "Logout",
description = "Log the currently logged in user out.",
responses(
(status = OK, description = "Logout successful")
),
tag = AUTH_TAG)]
pub async fn logout(mut auth_session: AuthBackendType) -> Result<(), ApiError> {
auth_session.logout().await?;
Ok(())
}