pomdtr/val_to_listitem

References

Referenced 1 time

This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.

Readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
import { valToListItem } from "https://esm.town/v/pomdtr/val_to_listitem";
export default async function(ctx: BrowserContext<{ user: string }>) {
const { user: userID } = ctx.params;
const resp = await fetch(`https://api.val.town/v1/users/${userID}/vals?limit=100`, {
headers: {
Authorization: `Bearer ${Deno.env.get("valtown")}`,
},
});
if (!resp.ok) {
throw new Error(await resp.text());
}
const { data: vals } = await resp.json();
const items = vals.map(valToListItem);
return {
type: "push",
page: {
type: "list",
items,
},
};
}
// #web
1
Next