File tree Expand file tree Collapse file tree
src/app/features/project/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,10 +36,12 @@ export class SettingsMapper {
3636 description : data . attributes . description ,
3737 isPublic : data . attributes . public ,
3838 region : {
39- id : data . embeds . region . data . id ,
40- name : data . embeds . region . data . attributes . name ,
39+ id : data . embeds ? .region . data . id ,
40+ name : data . embeds ? .region . data . attributes . name ,
4141 } ,
42- affiliatedInstitutions : InstitutionsMapper . fromInstitutionsResponse ( data . embeds . affiliated_institutions ) ,
42+ affiliatedInstitutions : data . embeds
43+ ? InstitutionsMapper . fromInstitutionsResponse ( data . embeds . affiliated_institutions )
44+ : [ ] ,
4345 lastFetched : Date . now ( ) ,
4446 } ;
4547 }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { JsonApiService } from '@shared/services';
1414
1515import { SettingsMapper } from '../mappers' ;
1616import {
17+ NodeDataJsonApi ,
1718 NodeDetailsModel ,
1819 NodeResponseJsonApi ,
1920 ProjectSettingsData ,
@@ -74,8 +75,8 @@ export class SettingsService {
7475
7576 updateProjectById ( model : UpdateNodeRequestModel ) : Observable < NodeDetailsModel > {
7677 return this . jsonApiService
77- . patch < NodeResponseJsonApi > ( `${ this . baseUrl } /nodes/${ model ?. data ?. id } /` , model )
78- . pipe ( map ( ( response ) => SettingsMapper . fromNodeResponse ( response . data ) ) ) ;
78+ . patch < NodeDataJsonApi > ( `${ this . baseUrl } /nodes/${ model ?. data ?. id } /` , model )
79+ . pipe ( map ( ( response ) => SettingsMapper . fromNodeResponse ( response ) ) ) ;
7980 }
8081
8182 deleteProject ( projectId : string ) : Observable < void > {
Original file line number Diff line number Diff line change @@ -99,8 +99,11 @@ export class SettingsState {
9999 tap ( ( updatedProject ) => {
100100 ctx . patchState ( {
101101 projectDetails : {
102- ...ctx . getState ( ) . projectDetails ,
103- data : updatedProject ,
102+ data : {
103+ ...ctx . getState ( ) . projectDetails . data ,
104+ title : updatedProject . title ,
105+ description : updatedProject . description ,
106+ } ,
104107 isLoading : false ,
105108 error : null ,
106109 } ,
You can’t perform that action at this time.
0 commit comments