fix: Use username field instead of display_name in profile
- Updated profile-actions.ts to use username column - Updated ProfileForm.tsx to use username - Updated settings page to pass username - Matches database schema (profiles.username)
This commit is contained in:
@@ -8,12 +8,12 @@ import { updateProfile } from '@/services/profile-actions';
|
||||
interface ProfileFormProps {
|
||||
initialData: {
|
||||
email?: string;
|
||||
display_name?: string | null;
|
||||
username?: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
export default function ProfileForm({ initialData }: ProfileFormProps) {
|
||||
const [displayName, setDisplayName] = useState(initialData.display_name || '');
|
||||
const [username, setUsername] = useState(initialData.username || '');
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const [status, setStatus] = useState<'idle' | 'success' | 'error'>('idle');
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -24,7 +24,7 @@ export default function ProfileForm({ initialData }: ProfileFormProps) {
|
||||
setError(null);
|
||||
|
||||
const formData = new FormData();
|
||||
formData.set('display_name', displayName);
|
||||
formData.set('username', username);
|
||||
|
||||
startTransition(async () => {
|
||||
const result = await updateProfile(formData);
|
||||
@@ -66,16 +66,16 @@ export default function ProfileForm({ initialData }: ProfileFormProps) {
|
||||
<p className="mt-1 text-xs text-zinc-500">E-Mail kann nicht geändert werden</p>
|
||||
</div>
|
||||
|
||||
{/* Display Name */}
|
||||
{/* Username */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-zinc-400 mb-2">
|
||||
Anzeigename
|
||||
Benutzername
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={displayName}
|
||||
onChange={(e) => setDisplayName(e.target.value)}
|
||||
placeholder="Dein Name"
|
||||
value={username}
|
||||
onChange={(e) => setUsername(e.target.value)}
|
||||
placeholder="Dein Benutzername"
|
||||
className="w-full px-4 py-3 bg-zinc-800 border border-zinc-700 rounded-xl text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user