v2.exhq.dev/review/App.tsx

47 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-08-04 08:16:51 +02:00
import '../src/App.css'
import "./reviewed.css"
import { sendReview } from '../src/components/api'
export default function App() {
const token = window.location.hash.substring(window.location.hash.indexOf("access_token") + "access_token".length + 1).substring(0, 30)
2024-08-26 11:27:16 +02:00
console.log(token)
2024-08-04 08:16:51 +02:00
let ref!: HTMLTextAreaElement;
2024-08-26 11:27:16 +02:00
return token !== "" ? <div class='reviewOuterparent'>
2024-08-04 08:16:51 +02:00
<div class='reviewParent'>
<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 shitty 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 yo shi</button>
</div>
</div>
2024-08-26 11:27:16 +02:00
</div> : <div> fuckin dumbass doesnt know how to AUTHENTICATE BEFORE TRYING TO REVIEW</div>
2024-08-04 08:16:51 +02:00
}