dont ever buy api from the github bro
This commit is contained in:
parent
de77c0d6d8
commit
fc400b4eab
3 changed files with 50 additions and 18 deletions
|
@ -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 <div class="singlereview">
|
||||
<img src={`https://dp.nea.moe/avatar/${props.discordID}.png`} />
|
||||
<div class="reviewinfo">
|
||||
<div class="reviewname"> {props.global_name === null ? props.username : props.global_name} </div>
|
||||
<div class="reviewtext"> {props.reviewText}</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
export const theImager = async (id: string): Promise<string> => (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 (
|
||||
<div class="singlereview">
|
||||
<img
|
||||
src={imageSrc()}
|
||||
alt="User Avatar"
|
||||
style={{ "max-width": "3em", "border-radius": "30%" }}
|
||||
/>
|
||||
<div class="reviewinfo">
|
||||
<div class="reviewname">
|
||||
{props.global_name === null ? props.username : props.global_name}
|
||||
</div>
|
||||
<div class="reviewtext">{props.reviewText}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export async function sendReview(review: string, token: string): Promise<boolean> {
|
||||
try {
|
||||
const response = await fetch(`https://api.review.exhq.dev/sendreview?review=${review}`, {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { createSignal, onMount } from "solid-js";
|
||||
import { theImager } from "./api"
|
||||
import "./comps.css"
|
||||
// warning: this IS horrible code. its a joke. DO NOT try this at home because
|
||||
// your local senior programmer CAN and WILL hunt you down
|
||||
|
@ -7,8 +9,24 @@ export function AdvancedBr({ count }: { count: number }) {
|
|||
}
|
||||
|
||||
export function SingularOomfie({ url, discordid }: { name: string, url: string, discordid: string }) {
|
||||
return <a href={url}><img class="tooltip" style={{
|
||||
"max-width": "3em",
|
||||
"border-radius": "30%"
|
||||
}} src={`https://dp.nea.moe/avatar/${discordid}.png`} alt="LMAO IMAGINE BEING BLIND" /> </a>
|
||||
const [imageSrc, setImageSrc] = createSignal("");
|
||||
|
||||
onMount(async () => {
|
||||
const url = await theImager(discordid);
|
||||
setImageSrc(url);
|
||||
});
|
||||
|
||||
return (
|
||||
<a href={imageSrc()}>
|
||||
<img
|
||||
class="tooltip"
|
||||
style={{
|
||||
"max-width": "3em",
|
||||
"border-radius": "30%",
|
||||
}}
|
||||
src={imageSrc()}
|
||||
alt="LMAO IMAGINE BEING BLIND"
|
||||
/>
|
||||
</a>
|
||||
);
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue