Auth via paskia-js: profile() dialog, apiFetch/apiJson in admin components

- Banner-corner auth link is now a button opening paskia-js's profile()
  dialog (handles login too); auth re-probed when the dialog closes.
- Editor/analytics components call /_api via apiFetch/apiJson: an
  expired session opens the login dialog and the request retries.
- pagerite.js: task-checkbox toggle uses apiJson (explicit edit attempt,
  reverts on any failure incl. cancelled login); auth probes use
  fetchJson (never a dialog); page-cache/navigation stay on plain fetch.
- Add the paskia npm dependency; document the convention.
This commit is contained in:
LeoVasanko committed 2026-09-18 20:14:52 +00:00
1 parent e0c1b37c0b
commit 4bccf6855e
13 files changed
+80 -60

No files matched your search

+2 -2
View File
@@ -5,6 +5,7 @@
// visit/crawler tables. Read-only.
// See docs/analytics.md for the data format.
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import { apiJson } from 'paskia'
import {
RANGES,
rangeWindow,
@@ -115,8 +116,7 @@ onMounted(async () => {
// The site tree for the transition map (all pages in menu order). Not
// fatal: without it the map just narrows to pages seen in transitions.
try {
const res = await fetch('/_api/pages')
if (res.ok) pageTree.value = await res.json()
pageTree.value = await apiJson('/_api/pages')
} catch { /* map just narrows to pages seen in transitions */ }
})