1
0
Fork 0
amy.rip/review/App.tsx
amy 4dc6f95e84
Some checks failed
Build / Build (push) Has been cancelled
Build / Deploy (push) Has been cancelled
this should fix it
2025-06-04 18:24:41 +03:30

74 lines
2.1 KiB
TypeScript

import "../src/App.css";
import "./reviewed.css";
import { sendReview } from "../src/components/api";
export default function App() {
const hash = window.location.hash;
const hashContent = hash.startsWith('#') ? hash.substring(1) : hash;
const params = new URLSearchParams(hashContent);
const token = params.get('access_token')!;
if (token) {
console.log("Access Token:", token);
// Do something with your token
} else {
console.log("Access Token not found in hash.");
window.location.href =
"https://discord.com/oauth2/authorize?client_id=1208380910525743134&response_type=token&redirect_uri=https%3A%2F%2Famy.rip%2Freview%2F&scope=identify";
}
console.log(token);
let ref!: HTMLTextAreaElement;
return (
<div class="reviewOuterparent">
<div class="reviewParent">
<p>DISCLAIMER: YOUR DISCORD ID WILL BE ATTACHED TO THE REVIEW IN THE SOURCE CODE.</p>
<textarea
ref={ref}
onKeyPress={async (e) => {
if (e.key === "Enter") {
e.preventDefault();
if (await sendReview(ref.value, token)) {
alert("review sent!");
} else {
alert(
"something went wrong, check your network tab or something idfk",
);
}
}
}}
placeholder="your review"
class="reviewText"
name=""
id=""
cols="25"
rows="3"
></textarea>
<div class="flexButton">
<button
onclick={async () => {
try {
const success = await sendReview(ref.value, token);
if (success) {
alert("Review sent successfully!");
} else {
alert(
"Failed to send review. open your browser's network tab for more info lmao",
);
}
} catch (error) {
alert("how");
}
}}
class="sendButton"
>
send your review
</button>
</div>
</div>
</div>
);
}