2022-11-30 09:58:19 +00:00
|
|
|
import styles from "../styles/Home.module.css";
|
2022-12-01 08:33:51 +00:00
|
|
|
|
|
|
|
interface AuthResponse {
|
|
|
|
authUrl: string;
|
|
|
|
}
|
2022-11-30 08:11:45 +00:00
|
|
|
|
|
|
|
export default function Home() {
|
2022-12-01 08:33:51 +00:00
|
|
|
const handleSignInWithTwitter = async () => {
|
2022-12-05 10:50:13 +00:00
|
|
|
const { authUrl }: AuthResponse = await (await fetch("/api/auth")).json();
|
2022-11-30 13:49:09 +00:00
|
|
|
|
2022-12-05 10:50:13 +00:00
|
|
|
window.location.href = authUrl;
|
2022-11-30 13:49:09 +00:00
|
|
|
};
|
|
|
|
|
2022-11-30 08:11:45 +00:00
|
|
|
return (
|
|
|
|
<div className={styles.container}>
|
2022-12-01 08:33:51 +00:00
|
|
|
<div>
|
|
|
|
<button onClick={handleSignInWithTwitter}>Sign in with Twitter</button>
|
|
|
|
</div>
|
2022-11-30 08:11:45 +00:00
|
|
|
</div>
|
2022-11-30 09:58:19 +00:00
|
|
|
);
|
2022-11-30 08:11:45 +00:00
|
|
|
}
|