@ -106,14 +106,14 @@ export default function ClubProfileTab({ clubId, onUpdate }: ClubProfileTabProps
const prof = result . data ;
setProfile ( prof ) ;
// Populate form - read from settings structure
// Populate form - read from top-level address and settings.contact
setName ( prof . name ) ;
setTimezone ( prof . timezone ) ;
setAddressLine1 ( prof . settings? . address ? . line_1 || '' ) ;
setAddressLine2 ( prof . settings? . address ? . line_2 || '' ) ;
setCity ( prof . settings? . address? . city || '' ) ;
setPostalCode ( prof . settings? . address? . postal_code || '' ) ;
setCountry ( prof . settings? . address? . country || '' ) ;
setAddressLine1 ( prof . address? . address_ line_1 || '' ) ;
setAddressLine2 ( prof . address? . address_ line_2 || '' ) ;
setCity ( prof . address? . city || '' ) ;
setPostalCode ( prof . address? . zi p || '' ) ;
setCountry ( prof . address? . country || '' ) ;
setPhone ( prof . settings ? . contact ? . phone || '' ) ;
setEmail ( prof . settings ? . contact ? . email || '' ) ;
setWebsite ( prof . settings ? . contact ? . website || '' ) ;
@ -160,31 +160,28 @@ export default function ClubProfileTab({ clubId, onUpdate }: ClubProfileTabProps
setError ( null ) ;
setSuccess ( false ) ;
// Build settings structure, preserving existing settings
const updatedSettings = {
. . . profile ? . settings ,
// Build request with top-level address and settings.contact
const request : ClubProfileUpdateRequest = {
name : name.trim ( ) ,
timezone ,
address : {
. . . profile ? . settings ? . address ,
line_1 : addressLine1.trim ( ) || undefined ,
line_2 : addressLine2.trim ( ) || undefined ,
address_line_1 : addressLine1.trim ( ) || undefined ,
address_line_2 : addressLine2.trim ( ) || undefined ,
city : city.trim ( ) || undefined ,
postal_code : postalCode.trim ( ) || undefined ,
zi p: postalCode.trim ( ) || undefined ,
country : country.trim ( ) || undefined ,
} ,
contact : {
. . . profile ? . settings ? . contact ,
phone : phone.trim ( ) || undefined ,
email : email.trim ( ) || undefined ,
website : website.trim ( ) || undefined ,
settings : {
. . . profile ? . settings ,
contact : {
. . . profile ? . settings ? . contact ,
phone : phone.trim ( ) || undefined ,
email : email.trim ( ) || undefined ,
website : website.trim ( ) || undefined ,
} ,
} ,
} ;
const request : ClubProfileUpdateRequest = {
name : name.trim ( ) ,
timezone ,
settings : updatedSettings ,
} ;
const result = await updateClubProfile ( clubId , request ) ;
if ( result . success ) {
@ -218,14 +215,14 @@ export default function ClubProfileTab({ clubId, onUpdate }: ClubProfileTabProps
function handleCancel() {
if ( ! profile ) return ;
// Reset form to original values - read from settings structure
// Reset form to original values - read from top-level address and settings.contact
setName ( profile . name ) ;
setTimezone ( profile . timezone ) ;
setAddressLine1 ( profile . settings? . address ? . line_1 || '' ) ;
setAddressLine2 ( profile . settings? . address ? . line_2 || '' ) ;
setCity ( profile . settings? . address? . city || '' ) ;
setPostalCode ( profile . settings? . address? . postal_code || '' ) ;
setCountry ( profile . settings? . address? . country || '' ) ;
setAddressLine1 ( profile . address? . address_ line_1 || '' ) ;
setAddressLine2 ( profile . address? . address_ line_2 || '' ) ;
setCity ( profile . address? . city || '' ) ;
setPostalCode ( profile . address? . zi p || '' ) ;
setCountry ( profile . address? . country || '' ) ;
setPhone ( profile . settings ? . contact ? . phone || '' ) ;
setEmail ( profile . settings ? . contact ? . email || '' ) ;
setWebsite ( profile . settings ? . contact ? . website || '' ) ;