MessagesForMacintosh/JS/node_modules/apollo-client/data/mutations.js

41 lines
1.3 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MutationStore = (function () {
function MutationStore() {
this.store = {};
}
MutationStore.prototype.getStore = function () {
return this.store;
};
MutationStore.prototype.get = function (mutationId) {
return this.store[mutationId];
};
MutationStore.prototype.initMutation = function (mutationId, mutation, variables) {
this.store[mutationId] = {
mutation: mutation,
variables: variables || {},
loading: true,
error: null,
};
};
MutationStore.prototype.markMutationError = function (mutationId, error) {
var mutation = this.store[mutationId];
if (mutation) {
mutation.loading = false;
mutation.error = error;
}
};
MutationStore.prototype.markMutationResult = function (mutationId) {
var mutation = this.store[mutationId];
if (mutation) {
mutation.loading = false;
mutation.error = null;
}
};
MutationStore.prototype.reset = function () {
this.store = {};
};
return MutationStore;
}());
exports.MutationStore = MutationStore;
//# sourceMappingURL=mutations.js.map