Readme

fetches a simplified version of a Glif response object; I use this in other glifs with the WebFetcher block

use like: https://jamiedubs-glifjson.web.val.run/?id=clgh1vxtu0011mo081dplq3xs

to fetch only the raw glif JSON, specify ?data=1: https://jamiedubs-glifjson.web.val.run/?id=clgh1vxtu0011mo081dplq3xs&data=1

to fetch a list of recently featured glifs try @jamiedubs/glifs

#glif #glifs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const glifJson = async (id: string) => {
const url = `https://alpha.glif.xyz/api/glifs?id=${id}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data && data.length > 0 && data[0].data) {
return { data: data[0].data };
}
else {
throw new Error("Invalid data structure");
}
}
catch (error) {
return { error: error.message };
}
};
Only the latest version can be previewed
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.