import { useEmailAuth } from "@sqds/grid-react";
function Auth() {
const { requestOtp, verifyOtp, logout, user, account, isAuthenticated } = useEmailAuth();
const handleLogin = async () => {
await requestOtp("user@example.com");
const code = prompt("Enter OTP:");
await verifyOtp(code);
};
if (isAuthenticated) {
return (
<div>
<p>Signed in as {user?.data.email}</p>
<p>Account: {account?.data.address}</p>
<button onClick={logout}>Logout</button>
</div>
);
}
return <button onClick={handleLogin}>Sign In</button>;
}