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:
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user