File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -1588,7 +1588,12 @@ class BaseService extends RequestBuilder {
1588
1588
}
1589
1589
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
1590
1590
const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
1591
- return await this . client . makePostRequest ( this . endpoint , payload ) ;
1591
+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
1592
+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
1593
+ return {
1594
+ ...resp ,
1595
+ data : hydratedData
1596
+ } ;
1592
1597
}
1593
1598
async update ( id , model , params ) {
1594
1599
if ( params ) {
Original file line number Diff line number Diff line change @@ -31,7 +31,12 @@ export class BaseService extends RequestBuilder {
31
31
}
32
32
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
33
33
const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
34
- return await this . client . makePostRequest ( this . endpoint , payload ) ;
34
+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
35
+ const hydratedData = this . hydrator . hydrateResponse ( resp . data , resp . included || [ ] ) ;
36
+ return {
37
+ ...resp ,
38
+ data : hydratedData ,
39
+ } ;
35
40
}
36
41
async update ( id , model , params ) {
37
42
if ( params ) {
Original file line number Diff line number Diff line change @@ -46,7 +46,14 @@ export class BaseService<T extends Model> extends RequestBuilder {
46
46
}
47
47
const jsonApiSerializer = new JsonApiSerializer ( this . hydrator . getModelMap ( ) ) ;
48
48
const payload = jsonApiSerializer . buildCreatePayload ( model ) ;
49
- return await this . client . makePostRequest ( this . endpoint , payload ) ;
49
+ let resp = await this . client . makePostRequest ( this . endpoint , payload ) ;
50
+
51
+ const hydratedData = this . hydrator . hydrateResponse < T > ( resp . data as JsonData | JsonData [ ] , resp . included || [ ] ) ;
52
+
53
+ return {
54
+ ...resp ,
55
+ data : hydratedData ,
56
+ } as InternalResponse < T > ;
50
57
}
51
58
52
59
async update ( id : string , model : Model , params ?: unknown ) : Promise < InternalResponse < T > > {
You can’t perform that action at this time.
0 commit comments