File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export class JsonApiModel {
66
66
let hasMany : any = Reflect . getMetadata ( 'HasMany' , this ) ;
67
67
if ( hasMany ) {
68
68
for ( let metadata of hasMany ) {
69
- let relationship : any = data . relationships [ metadata . relationship ] ;
69
+ let relationship : any = data . relationships ? data . relationships [ metadata . relationship ] : null ;
70
70
if ( relationship && relationship . data && relationship . data . length > 0 ) {
71
71
let typeName : string = relationship . data [ 0 ] . type ;
72
72
let modelType : ModelType = Reflect . getMetadata ( 'JsonApiDatastoreConfig' , this . _datastore . constructor ) . models [ typeName ] ;
@@ -83,7 +83,7 @@ export class JsonApiModel {
83
83
let belongsTo : any = Reflect . getMetadata ( 'BelongsTo' , this ) ;
84
84
if ( belongsTo ) {
85
85
for ( let metadata of belongsTo ) {
86
- let relationship : any = data . relationships [ metadata . relationship ] ;
86
+ let relationship : any = data . relationships ? data . relationships [ metadata . relationship ] : null ;
87
87
if ( relationship && relationship . data ) {
88
88
let dataRelationship : any = ( relationship . data instanceof Array ) ? relationship . data [ 0 ] : relationship . data ;
89
89
if ( dataRelationship ) {
You can’t perform that action at this time.
0 commit comments