File tree Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ export class UserService {
53
53
}
54
54
55
55
updateUserProfile ( userId : string , key : string , data : ProfileSettingsUpdate ) : Observable < User > {
56
- const patchedData = key === ProfileSettingsKey . User ? data : { [ key ] : data } ;
56
+ let data_formatted = ProfileSettingsKey . User && data . hasOwnProperty ( 'acceptedTermsOfService' ) ? { accepted_terms_of_service : true } : data ;
57
+ const patchedData = key === ProfileSettingsKey . User ? data_formatted : { [ key ] : data_formatted } ;
57
58
58
59
return this . jsonApiService
59
60
. patch < UserDataJsonApi > ( `${ this . apiUrl } /users/${ userId } /` , {
Original file line number Diff line number Diff line change @@ -263,6 +263,14 @@ export class UserState {
263
263
return ;
264
264
}
265
265
266
+ // Todo: try find a way how to convert acceptedTermsOfService to accepted_terms_of_service in updateUserProfile
267
+ // more generic with mappers
268
+ // const updatePayload: Partial<User> = {
269
+ // acceptedTermsOfService: true,
270
+ // };
271
+ // const apiRequest = UserMapper.toAcceptedTermsOfServiceRequest(updatePayload);
272
+ // .updateUserProfile(currentUser.id, ProfileSettingsKey.User, apiRequest)
273
+
266
274
return this . userService
267
275
. updateUserProfile ( currentUser . id , ProfileSettingsKey . User , { acceptedTermsOfService : true } )
268
276
. pipe (
Original file line number Diff line number Diff line change 1
1
import {
2
- User ,
2
+ User , UserAcceptedTermsOfServiceJsonApi ,
3
3
UserData ,
4
4
UserDataJsonApi ,
5
5
UserDataResponseJsonApi ,
@@ -68,4 +68,11 @@ export class UserMapper {
68
68
suffix : name . suffix ?? '' ,
69
69
} ;
70
70
}
71
+
72
+ static toAcceptedTermsOfServiceRequest ( name : Partial < User > ) : UserAcceptedTermsOfServiceJsonApi {
73
+ return {
74
+ accepted_terms_of_service : name . acceptedTermsOfService ?? false ,
75
+ } ;
76
+ }
77
+
71
78
}
Original file line number Diff line number Diff line change @@ -105,3 +105,7 @@ export interface UserData {
105
105
activeFlags : string [ ] ;
106
106
currentUser : User | null ;
107
107
}
108
+
109
+ export interface UserAcceptedTermsOfServiceJsonApi {
110
+ accepted_terms_of_service : boolean ;
111
+ }
You can’t perform that action at this time.
0 commit comments