diff --git a/app/src/app/Core/Router.php b/app/src/app/Core/Router.php index b1f5c413..ca353370 100644 --- a/app/src/app/Core/Router.php +++ b/app/src/app/Core/Router.php @@ -141,19 +141,21 @@ protected function handleMiddlewares(array $middlewares): void throw new Exception("Middleware {$middlewareClass} must implement MiddlewareInterface"); } - $middleware->handle($_REQUEST, fn () => null); + $middleware->handle($_REQUEST, fn() => null); } } protected function abort(int $statusCode, string $message): void { - if ($statusCode === 404) { - View::render([ - 'view' => 'Error/404', - 'title' => 'Error 404', - 'layout' => 'BlankLayout' - ]); - } + View::render([ + 'view' => "Error", + 'title' => "Error $statusCode", + 'layout' => 'PublicLayout', + 'data' => [ + 'code' => $statusCode, + 'message' => $message, + ], + ]); http_response_code($statusCode); exit; } diff --git a/app/src/app/Layouts/BlankLayout.php b/app/src/app/Layouts/BlankLayout.php index 3feb91b6..45b15835 100644 --- a/app/src/app/Layouts/BlankLayout.php +++ b/app/src/app/Layouts/BlankLayout.php @@ -1,19 +1 @@ - - - - - - - - <?= htmlspecialchars($title) . ' - ' . htmlspecialchars(getenv('APP_NAME')); ?> - - - - - - - - - - - + + + + + + + + <?= $title . ' - ' . getenv('APP_NAME'); ?> + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/app/Views/Error/403.php b/app/src/app/Views/Error.php similarity index 50% rename from app/src/app/Views/Error/403.php rename to app/src/app/Views/Error.php index 22b90eaa..50447d03 100644 --- a/app/src/app/Views/Error/403.php +++ b/app/src/app/Views/Error.php @@ -1,9 +1,9 @@
-

403

-

Acceso Denegado

-

Lo sentimos, la página a la que intentas acceder no está disponible para ti.

-
+

+

+ +
Volver al Inicio diff --git a/app/src/app/Views/Error/404.php b/app/src/app/Views/Error/404.php deleted file mode 100644 index cd402945..00000000 --- a/app/src/app/Views/Error/404.php +++ /dev/null @@ -1,12 +0,0 @@ -
-
-

404

-

Página no encontrada

-

Lo sentimos, la página que buscas no existe o fue movida.

- -
-
\ No newline at end of file