OpenAuth_views/src/pages/User/api.ts

34 lines
665 B
TypeScript

export async function isAdmin() {
return Promise.resolve(true);
}
export async function getName() {
if (cache.has("name")) {
return cache.get("name");
} else {
const { name } = await fetch("/api/config.json").then((res) =>
res.json()
);
cache.set("name", name);
return name;
}
}
const cache = new Map<string, any>();
export async function getFeatured() {
if (cache.has("featured")) {
return cache.get("featured");
} else {
const { clients } = await fetch("/api/client/featured").then((res) =>
res.json()
);
cache.set("featured", clients);
return clients;
}
}