diff --git a/api/app_builder/error_handlers.py b/api/app_builder/error_handlers.py index 7d65408..67ea0a1 100644 --- a/api/app_builder/error_handlers.py +++ b/api/app_builder/error_handlers.py @@ -2,20 +2,18 @@ from fastapi import FastAPI, Request from fastapi.responses import JSONResponse from api.domain.error import DomainValidationError -from api.domain.user.error import (UserAlreadyExistsError, - UserInvalidCredentialsError, - UserIsNotAuthorizedError) +from api.domain.user.error import ( + UserAlreadyExistsError, + UserInvalidCredentialsError, + UserIsNotAuthorizedError, +) -async def validation_error_exc_handler( - request: Request, exc: DomainValidationError -) -> JSONResponse: +async def validation_error_exc_handler(request: Request, exc: DomainValidationError) -> JSONResponse: return JSONResponse(status_code=400, content={"detail": exc.message}) -async def user_authentication_error_exc_handler( - request: Request, exc: UserIsNotAuthorizedError -) -> JSONResponse: +async def user_authentication_error_exc_handler(request: Request, exc: UserIsNotAuthorizedError) -> JSONResponse: return JSONResponse( status_code=401, content={"detail": exc.message}, @@ -23,9 +21,7 @@ async def user_authentication_error_exc_handler( ) -async def user_already_exist_error_exc_handler( - request: Request, exc: UserAlreadyExistsError -) -> JSONResponse: +async def user_already_exist_error_exc_handler(request: Request, exc: UserAlreadyExistsError) -> JSONResponse: return JSONResponse(status_code=409, content={"detail": exc.message}) @@ -40,12 +36,6 @@ def init_exc_handlers(app: FastAPI) -> None: DomainValidationError, validation_error_exc_handler, ) - app.add_exception_handler( - UserIsNotAuthorizedError, user_authentication_error_exc_handler - ) - app.add_exception_handler( - UserAlreadyExistsError, user_already_exist_error_exc_handler - ) - app.add_exception_handler( - UserInvalidCredentialsError, user_invalid_credentials_error_exc_handler - ) + app.add_exception_handler(UserIsNotAuthorizedError, user_authentication_error_exc_handler) + app.add_exception_handler(UserAlreadyExistsError, user_already_exist_error_exc_handler) + app.add_exception_handler(UserInvalidCredentialsError, user_invalid_credentials_error_exc_handler) diff --git a/api/presentation/routers/auth.py b/api/presentation/routers/auth.py index 2b4b950..85f2d28 100644 --- a/api/presentation/routers/auth.py +++ b/api/presentation/routers/auth.py @@ -45,7 +45,6 @@ async def login( async def logout( response: Response, ): - response.delete_cookie(key="access_token", httponly=True) return {"result": "logout"}