forked from OpenServer/OpenAuth_views
Making every thing nicer
This commit is contained in:
33
src/pages/User/api.ts
Normal file
33
src/pages/User/api.ts
Normal file
@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user