File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,20 @@ export default ApplicationSerializer.extend(CustomPrimaryKeyMixin, {
13
13
14
14
serialize ( ) {
15
15
const json = this . _super ( ...arguments ) ;
16
- delete json . data . relationships [ 'general-statistics' ] ;
17
- delete json . data . relationships [ 'order-statistics' ] ;
16
+
17
+ const { relationships } = json . data ;
18
+ // We are deleting read only relationships so that they don't
19
+ // break the server. Since these relationships are not always
20
+ // present, we catch and ignore the error
21
+ try {
22
+ delete relationships [ 'general-statistics' ] ;
23
+ } catch { } // eslint-disable-line no-empty
24
+ try {
25
+ delete relationships [ 'order-statistics' ] ;
26
+ } catch { } // eslint-disable-line no-empty
18
27
19
28
return json ;
29
+
20
30
}
21
31
22
32
} ) ;
You can’t perform that action at this time.
0 commit comments