@@ -72,22 +72,20 @@ async function updateMyProfile(currentUser, files, data) {
72
72
// get member's current address data
73
73
const member = await helper . getMember (
74
74
currentUser . handle ,
75
- "fields=addresses,competitionCountryCode"
75
+ "fields=addresses,competitionCountryCode,homeCountryCode "
76
76
) ;
77
77
const update = { } ;
78
78
// update member data if city is different from existing one
79
79
if ( _ . get ( member , "addresses[0].city" ) !== data . city ) {
80
80
update . addresses = _ . cloneDeep ( member . addresses ) ;
81
81
if ( ! _ . isEmpty ( update . addresses ) ) {
82
82
update . addresses [ 0 ] . city = data . city ;
83
- update . addresses [ 0 ] . updatedAt = parseInt ( new Date ( ) . getTime ( ) / 1000 ) ;
84
- update . addresses [ 0 ] . updatedBy = currentUser . userId . toString ( ) ;
83
+ delete update . addresses [ 0 ] . createdAt ;
84
+ delete update . addresses [ 0 ] . updatedAt ;
85
85
} else {
86
86
update . addresses = [
87
87
{
88
88
city : data . city ,
89
- createdAt : parseInt ( new Date ( ) . getTime ( ) / 1000 ) ,
90
- createdBy : currentUser . userId . toString ( ) ,
91
89
} ,
92
90
] ;
93
91
}
@@ -96,6 +94,9 @@ async function updateMyProfile(currentUser, files, data) {
96
94
if ( _ . get ( member , "competitionCountryCode" ) !== data . country ) {
97
95
update . competitionCountryCode = data . country ;
98
96
}
97
+ if ( _ . get ( member , "homeCountryCode" ) !== data . country ) {
98
+ update . homeCountryCode = data . country ;
99
+ }
99
100
// avoid unnecessary api calls
100
101
if ( ! _ . isEmpty ( update ) ) {
101
102
await helper . updateMember ( currentUser , update ) ;
0 commit comments