Skip to content

Commit

Permalink
rename logout route
Browse files Browse the repository at this point in the history
  • Loading branch information
j-chad committed Sep 30, 2023
1 parent 5cdaa90 commit d77d0b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/src/api/api_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use utoipa::{Modify, OpenApi};
paths(
auth_routes::register,
auth_routes::login,
auth_routes::logout,
auth_routes::delete_refresh_token,
auth_routes::refresh_token,
auth_routes::get_user,
),
Expand Down
6 changes: 3 additions & 3 deletions backend/src/api/auth/controllers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ pub async fn login(
///
/// This will invalidate the refresh token
#[utoipa::path(
post,
path = "/auth/logout",
delete,
path = "/auth/refresh_token",
tag = "auth",
security(
("api_token" = [])
Expand All @@ -128,7 +128,7 @@ pub async fn login(
(status = 204, description = "Logout successful"),
)
)]
pub async fn logout(
pub async fn delete_refresh_token(
State(state): State<AppState>,
Extension(user): Extension<CurrentUser>,
) -> Result<StatusCode, APIError> {
Expand Down
6 changes: 3 additions & 3 deletions backend/src/api/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use super::middleware::auth;
use crate::AppState;
use axum::routing::{get, post};
use axum::routing::{delete, get, post};
use axum::{middleware, Router};
use controllers::{get_user, login, logout, refresh_token, register};
use controllers::{delete_refresh_token, get_user, login, refresh_token, register};

pub mod controllers;
pub mod models;
mod utils;

pub fn get_router(state: AppState) -> Router<AppState> {
Router::new()
.route("/logout", post(logout))
.route("/logout", delete(delete_refresh_token))
.route("/user", get(get_user))
.route_layer(middleware::from_fn_with_state(state.clone(), auth))
.route("/register", post(register))
Expand Down

0 comments on commit d77d0b9

Please sign in to comment.