src/lib/solid.ts (view raw)
1import { getSolidDataset, getThingAll } from "@inrupt/solid-client";
2import { fetch } from "@inrupt/solid-client-authn-browser";
3import { thingToTask } from "./models/task";
4
5export const getPodTasks = async (podUrl: string) => {
6 const tasksDataset = await getSolidDataset(`${podUrl}/tasks/default`, {
7 fetch: fetch,
8 });
9 const things = getThingAll(tasksDataset);
10 return things.map(thingToTask);
11};
12
13// export const getProfile = async (webId: string) => {
14// const subjects = getAllSubjects(webId);
15
16// const findValue = (predicate: string) =>
17// subjects
18// .map(
19// subject =>
20// getStringNoLocale(subject, predicate) || getUrl(subject, predicate)
21// )
22// ?.filter(i => !!i)[0];
23
24// return {
25// name: findValue(FOAF.name),
26// organization: findValue(VCARD.organization_name),
27// image: findValue(VCARD.hasPhoto),
28// };
29// };