A free open source IT asset/license management system
Fixed weird status code error on ajax
snipe8f0ab1e719b8
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 6a931372f5..dad7b5b602 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -63,9 +63,11 @@ class Handler extends ExceptionHandlerif ($this->isHttpException($e)) {+ $statusCode = $e->getStatusCode();+switch ($e->getStatusCode()) {case '404':- return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' not found'), 404);+ return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' endpoint not found'), 404);break;case '405':return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405);@@ -79,17 +81,10 @@ class Handler extends ExceptionHandler}- if ($this->isHttpException($e)) {-- $statusCode = $e->getStatusCode();-- switch ($statusCode) {-- case '404':- return response()->view('layouts/basic', [- 'content' => view('errors/404')- ]);- }+ if ($this->isHttpException($e) && (isset($statusCode)) && ($statusCode == '404' )) {+ return response()->view('layouts/basic', [+ 'content' => view('errors/404')+ ]);}return parent::render($request, $e);