Skip to content

Commit f7658cd

Browse files
authored
Amend #4174 approach to still tolerate specref API call failure (#4219)
This covers the edge case of `data` being `null` due to the API call failing in dev, which I had originally allowed for with #4167, but then missed accounting for in #4174.
1 parent 3b34ff2 commit f7658cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

11ty/biblio.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ export async function getBiblio() {
3636
const response = await wrapAxiosRequest(
3737
axios.get(`https://api.specref.org/bibrefs?refs=${uniqueRefs.join(",")}`)
3838
);
39-
for (const [from, to] of Object.entries(invert(aliases)))
40-
response.data[to] = response.data[from];
39+
if (response.data) {
40+
for (const [from, to] of Object.entries(invert(aliases)))
41+
response.data[to] = response.data[from];
42+
}
4143

4244
return {
4345
...response.data,

0 commit comments

Comments
 (0)