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.
This commit is contained in:
parent
71e5fb8fda
commit
c065e065e9
2 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue