Skip to content

Commit 36cadc3

Browse files
committed
Bugfixes
1 parent c817852 commit 36cadc3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dist/vuex-orm-apollo.esm.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8506,7 +8506,7 @@ var VuexORMApollo = /** @class */ (function () {
85068506
var state = _a.state, dispatch = _a.dispatch;
85078507
var id = _b.id;
85088508
return __awaiter(this, void 0, void 0, function () {
8509-
var model, name, data, signature, query, newData, _c;
8509+
var model, name, data, signature, query, response, newData, _c;
85108510
return __generator(this, function (_d) {
85118511
switch (_d.label) {
85128512
case 0:
@@ -8522,8 +8522,8 @@ var VuexORMApollo = /** @class */ (function () {
85228522
'variables': (_c = {}, _c[model.singularName] = this.queryBuilder.transformOutgoingData(data), _c)
85238523
})];
85248524
case 1:
8525-
newData = _d.sent();
8526-
// Insert incoming data into the store
8525+
response = _d.sent();
8526+
newData = this.queryBuilder.transformIncomingData(response.data);
85278527
this.storeData(newData, dispatch);
85288528
return [2 /*return*/, newData];
85298529
}

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default class VuexORMApollo {
136136
* @param {any} id
137137
* @returns {Promise<void>}
138138
*/
139-
private async persist ({ state, dispatch }: ActionParams, { id }: ActionParams): Promise<FetchResult> {
139+
private async persist ({ state, dispatch }: ActionParams, { id }: ActionParams) {
140140
const model = this.getModel(state.$name);
141141
const name = `create${capitalizeFirstLetter(model.singularName)}`;
142142

@@ -156,14 +156,16 @@ export default class VuexORMApollo {
156156
delete data.id;
157157

158158
// Send GraphQL Mutation
159-
const newData = await this.apolloClient.mutate({
159+
const response = await this.apolloClient.mutate({
160160
'mutation': gql(query),
161161
'variables': {
162162
[model.singularName]: this.queryBuilder.transformOutgoingData(data)
163163
}
164164
});
165165

166+
166167
// Insert incoming data into the store
168+
const newData = this.queryBuilder.transformIncomingData(response.data as Data);
167169
this.storeData(newData, dispatch);
168170

169171
return newData;

0 commit comments

Comments
 (0)