'use client';
import { useState } from 'react';
import { useAuthStore } from '@/stores/auth';
export function AuthButton() {
const { isAuthenticated, username, did, loading, login, register, logout } = useAuthStore();
const [showRegister, setShowRegister] = useState(false);
const [regUsername, setRegUsername] = useState('');
const [error, setError] = useState('');
if (isAuthenticated) {
return (
Signed in as
{username || did?.slice(0, 16) + '...'}
);
}
if (showRegister) {
return (
setRegUsername(e.target.value)}
placeholder="Choose a username"
className="input text-sm py-1 px-2 w-40"
maxLength={20}
/>
{error && {error}}
);
}
return (
{error &&
{error}}
);
}