Pretty URL for the dashboard: /status -> /status.html
The documented URL did not work, and failed in the most misleading way possible: PocketBase's indexFallback (on by default) serves index.html for any unmatched static path, so /status returned the family landing page with HTTP 200. It looked like the dashboard had silently broken rather than like a missing route. Follows the existing /settings -> /settings.html pattern in settings.pb.js, which is presumably why that one has always worked. Validated on a clean boot with hooksWatch off: 302 to /status.html, the page titled 'Amber - stav služeb', /api/status still 401, no JS errors.
This commit is contained in:
parent
cb3f1407ff
commit
7a4f0d91f3
1 changed files with 8 additions and 0 deletions
|
|
@ -32,6 +32,14 @@
|
||||||
// anything a handler needs must be declared INSIDE it — file-scope helpers throw
|
// anything a handler needs must be declared INSIDE it — file-scope helpers throw
|
||||||
// ReferenceError at request time. Nothing is hoisted here; keep it that way.
|
// ReferenceError at request time. Nothing is hoisted here; keep it that way.
|
||||||
|
|
||||||
|
// Pretty URL, following the same pattern as /settings → /settings.html.
|
||||||
|
//
|
||||||
|
// Without it, `/status` does NOT 404 — PocketBase's `indexFallback` (on by
|
||||||
|
// default) quietly serves index.html for any unmatched static path, so the URL
|
||||||
|
// looked like it worked and returned the family landing page instead. The docs
|
||||||
|
// were written with the pretty URL, so the docs were wrong until this existed.
|
||||||
|
routerAdd("GET", "/status", (e) => e.redirect(302, "/status.html"))
|
||||||
|
|
||||||
routerAdd("GET", "/api/status", (e) => {
|
routerAdd("GET", "/api/status", (e) => {
|
||||||
// ---- helpers, all handler-local (isolated JSVM) ------------------------
|
// ---- helpers, all handler-local (isolated JSVM) ------------------------
|
||||||
const safe = (label, fn) => {
|
const safe = (label, fn) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue