From c065e065e9d5570557c572a6121fc5cc7c138dd3 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sat, 2 May 2026 21:54:43 +0300 Subject: [PATCH] fix admin texts route shadow conflict FastRoute rejected /api/texts/all because the previously declared variable route /api/texts/{textId} would shadow it, crashing the app on boot. move the admin all-texts endpoint to /api/admin/texts to clear the conflict; admin texts.js follows the new URL. --- bootstrap/app.php | 2 +- public/js/texts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap/app.php b/bootstrap/app.php index ce4d204..1e4d6cf 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -69,7 +69,7 @@ $app->group('', function (RouteCollectorProxy $group) { [ViewController::class, 'text'] ); - $group->get('/api/texts/all', [TextController::class, 'getAllTexts']); + $group->get('/api/admin/texts', [TextController::class, 'getAllTexts']); })->add(AdminMiddleware::class)->add(AuthMiddleware::class); return $app; diff --git a/public/js/texts.js b/public/js/texts.js index 6fca9fd..a4736ec 100644 --- a/public/js/texts.js +++ b/public/js/texts.js @@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', () => { const form = document.getElementById('texts-form'); async function loadTexts() { - const res = await fetch('/api/texts/all', { + const res = await fetch('/api/admin/texts', { credentials: 'same-origin', }); const texts = await res.json();