Refactor error check in AuthController.

Changed the error check in the AuthController from checking if the result is not successful to checking if the result has an error. This change was made to clarify the code and ensure that errors are handled properly.
This commit is contained in:
Leonid Nikitin 2023-07-06 22:32:29 +06:00
parent 6dd24ac1d3
commit 92206a028a
Signed by: kor-elf
GPG Key ID: 7DE8F80C5CEC2C0D

View File

@ -26,7 +26,7 @@ final class AuthController extends Controller
{ {
$authorization = $request->getDto(); $authorization = $request->getDto();
$result = $this->authService->authorization($authorization); $result = $this->authService->authorization($authorization);
if (!$result->isSuccess()) { if ($result->isError()) {
if ($result->getCode() === Response::HTTP_UNAUTHORIZED) { if ($result->getCode() === Response::HTTP_UNAUTHORIZED) {
Log::warning('Unauthorized ' . $authorization->getEmail() . ' [' . $request->getClientIp() . ']'); Log::warning('Unauthorized ' . $authorization->getEmail() . ' [' . $request->getClientIp() . ']');
} }