diff --git a/src/components/api.tsx b/src/components/api.tsx index 82d0f61..d3c2c96 100644 --- a/src/components/api.tsx +++ b/src/components/api.tsx @@ -21,7 +21,7 @@ export default function Reviews() { .then(response => response.json()) .then((data: Review[]) => { const promises = data.map(review => ( - fetch(`https://discordlookup.mesalytic.moe/v1/user/${review.discordID}`) + fetch(`https://dc-lookup.mono.exhq.dev/v1/user/${review.discordID}`) .then(response => response.json()) .then(user => ({ ...review, @@ -66,16 +66,33 @@ export default function Reviews() { } -function SingleReview(props: NeoReview) { - return
- -
-
{props.global_name === null ? props.username : props.global_name}
-
{props.reviewText}
-
-
-} +export const theImager = async (id: string): Promise => (await fetch(`https://dc-lookup.mono.exhq.dev/v1/user/${id}`) + .then(res => res.json()).then(data => data.avatar.link).catch(() => "https://http.cat/status/100")); + function SingleReview(props: NeoReview) { + const [imageSrc, setImageSrc] = createSignal(""); + + onMount(async () => { + const url = await theImager(props.discordID); + setImageSrc(url); + }); + + return ( +
+ User Avatar +
+
+ {props.global_name === null ? props.username : props.global_name} +
+
{props.reviewText}
+
+
+ ); + } export async function sendReview(review: string, token: string): Promise { try { const response = await fetch(`https://api.review.exhq.dev/sendreview?review=${review}`, { @@ -93,4 +110,4 @@ export async function sendReview(review: string, token: string): PromiseLMAO IMAGINE BEING BLIND + const [imageSrc, setImageSrc] = createSignal(""); + + onMount(async () => { + const url = await theImager(discordid); + setImageSrc(url); + }); + + return ( + + LMAO IMAGINE BEING BLIND + + ); } \ No newline at end of file diff --git a/src/components/utils.tsx b/src/components/utils.tsx index ae815b2..a7a9d4b 100644 --- a/src/components/utils.tsx +++ b/src/components/utils.tsx @@ -24,13 +24,10 @@ export async function getLatestItems(apiUrl: string) { throw new Error(`API call failed with status ${response.status}`); } const data = await response.json(); - // Check if data is an array if (!Array.isArray(data)) { throw new Error('API response is not an array'); } - // Slice the last 5 items const lastFive = data.slice(-5); - // Print or use the lastFive array as needed return lastFive; } catch (error) { console.error('Error fetching data:', error);