Skip to content

Commit

Permalink
Change logout endpoint to return SuccessResponse (LemmyNet#4121)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic authored Oct 31, 2023
1 parent 9007d49 commit df53d2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/api/src/local_user/logout.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::read_auth_token;
use activitypub_federation::config::Data;
use actix_web::{cookie::Cookie, HttpRequest, HttpResponse};
use lemmy_api_common::{context::LemmyContext, utils::AUTH_COOKIE_NAME};
use lemmy_api_common::{context::LemmyContext, utils::AUTH_COOKIE_NAME, SuccessResponse};
use lemmy_db_schema::source::login_token::LoginToken;
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
Expand All @@ -16,7 +16,7 @@ pub async fn logout(
let jwt = read_auth_token(&req)?.ok_or(LemmyErrorType::NotLoggedIn)?;
LoginToken::invalidate(&mut context.pool(), &jwt).await?;

let mut res = HttpResponse::Ok().finish();
let mut res = HttpResponse::Ok().json(SuccessResponse::default());
let cookie = Cookie::new(AUTH_COOKIE_NAME, "");
res.add_removal_cookie(&cookie)?;
Ok(res)
Expand Down

0 comments on commit df53d2a

Please sign in to comment.