icns-frontend/pages/index.tsx

20 lines
400 B
TypeScript
Raw Normal View History

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 () => {
const response: AuthResponse = await (await fetch("/api/auth")).json();
2022-11-30 13:49:09 +00:00
2022-12-01 08:33:51 +00:00
window.location.href = response.authUrl;
2022-11-30 13:49:09 +00:00
};
2022-11-30 08:11:45 +00:00
return (
<div>
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
}