(feat): add first release
This commit is contained in:
parent
fc0a1a982d
commit
2ba049f576
19 changed files with 1819 additions and 0 deletions
18
dist/user.js
vendored
Normal file
18
dist/user.js
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
export const userCacheMap = new Map();
|
||||
export async function get(userId) {
|
||||
try {
|
||||
const cachedUser = userCacheMap.get(userId);
|
||||
if (cachedUser) {
|
||||
return cachedUser;
|
||||
}
|
||||
const fetchedUser = await fetch("https://omega.tensamin.net/api/get/user/" + userId).then((res) => res.json());
|
||||
if (fetchedUser) {
|
||||
userCacheMap.set(userId, fetchedUser);
|
||||
}
|
||||
return fetchedUser;
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error fetching user data for userId:", userId, error);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue