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:
2025-12-26 21:35:41 +01:00
parent f74090c8a5
commit af54d8061c
3 changed files with 13 additions and 13 deletions

View File

@@ -20,13 +20,13 @@ export async function updateProfile(formData: FormData): Promise<ProfileUpdateRe
return { success: false, error: 'Nicht autorisiert' };
}
const displayName = formData.get('display_name') as string;
const username = formData.get('username') as string;
const { error } = await supabase
.from('profiles')
.upsert({
id: user.id,
display_name: displayName?.trim() || null,
username: username?.trim() || null,
updated_at: new Date().toISOString(),
});
@@ -98,14 +98,14 @@ export async function getProfile() {
const { data: profile } = await supabase
.from('profiles')
.select('id, display_name, avatar_url, created_at, updated_at')
.select('id, username, avatar_url, updated_at')
.eq('id', user.id)
.single();
return {
id: user.id,
email: user.email,
display_name: profile?.display_name || null,
username: profile?.username || null,
avatar_url: profile?.avatar_url || null,
created_at: user.created_at,
};