25 lines
787 B
Rust
25 lines
787 B
Rust
use crate::ApiResponse;
|
|
use crate::error::ApiError;
|
|
use actix_web::{HttpResponse, Result, web};
|
|
use service::AppService;
|
|
use session::Session;
|
|
|
|
#[utoipa::path(
|
|
post,
|
|
path = "/api/auth/logout",
|
|
responses(
|
|
(status = 401, description = "Unauthorized", body = ApiResponse<ApiError>),
|
|
(status = 200, description = "Logout successful", body = ApiResponse<String>),
|
|
(status = 500, description = "Internal server error", body = ApiResponse<ApiError>),
|
|
(status = 404, description = "Not found", body = ApiResponse<ApiError>),
|
|
),
|
|
tag = "Auth"
|
|
)]
|
|
pub async fn api_auth_logout(
|
|
service: web::Data<AppService>,
|
|
session: Session,
|
|
) -> Result<HttpResponse, ApiError> {
|
|
service.auth_logout(&session).await?;
|
|
Ok(crate::api_success())
|
|
}
|