This commit is contained in:
@@ -4,10 +4,14 @@ import { Button } from './ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
|
||||
import { Input } from './ui/input';
|
||||
import { Label } from './ui/label';
|
||||
import { authClient, useSession, signOut, updateUser } from '../lib/auth-client';
|
||||
import { useSession, signOut, updateUser } from '../lib/auth-client';
|
||||
import { validatePhoneOrEmail } from '../lib/validators';
|
||||
|
||||
export function ProfileSettings() {
|
||||
interface Props {
|
||||
onNameChange?: (name: string | null) => void;
|
||||
}
|
||||
|
||||
export function ProfileSettings({ onNameChange }: Props = {}) {
|
||||
const { data: session } = useSession();
|
||||
const [userName, setUserName] = useState('');
|
||||
const [savingName, setSavingName] = useState(false);
|
||||
@@ -59,7 +63,7 @@ export function ProfileSettings() {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setNameError(data.error || 'Failed to save name.');
|
||||
} else {
|
||||
await authClient.getSession({ fetchOptions: { cache: 'no-store' } });
|
||||
onNameChange?.(trimmed || null);
|
||||
setNameSaved(true);
|
||||
setTimeout(() => setNameSaved(false), 3000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user