]> Lady’s Gitweb - x_status_git/commitdiff
Retry without cache if loading a status fails
authorLady <redacted>
Sun, 17 Dec 2023 02:50:10 +0000 (21:50 -0500)
committerLady <redacted>
Sat, 23 Dec 2023 20:17:52 +0000 (15:17 -0500)
status.html

index 11425551df859f5f1703c328a1596218cb1e15c4..e1c68ad306aab8e9c17d026b9868d51f668205da 100644 (file)
@@ -15,8 +15,13 @@ footer small{ Font-Size: Inherit; Font-Style: Italic }
 <BODY>
 <SCRIPT Type=module>
 const parser = new DOMParser
 <BODY>
 <SCRIPT Type=module>
 const parser = new DOMParser
-fetch(`${new URL(".", location).toString().slice(0, -1)}.jsonld`)
+const index = `${new URL(".", location).toString().slice(0, -1)}.jsonld`
+fetch(index)
 .then($ => $.json())
 .then($ => $.json())
+.then(meta => {
+  const { items } = meta
+  if (items.find($ => new URL($["@id"]).pathname === location.pathname)) return meta
+  else return fetch(index, { cache: "reload" }).then($ => $.json()) })
 .then(meta => {
   const { items, subject } = meta
   const n = items.findIndex($ => new URL($["@id"]).pathname === location.pathname)
 .then(meta => {
   const { items, subject } = meta
   const n = items.findIndex($ => new URL($["@id"]).pathname === location.pathname)
This page took 0.022513 seconds and 4 git commands to generate.