UNPKG

1.29 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var MutationStore = (function () {
4 function MutationStore() {
5 this.store = {};
6 }
7 MutationStore.prototype.getStore = function () {
8 return this.store;
9 };
10 MutationStore.prototype.get = function (mutationId) {
11 return this.store[mutationId];
12 };
13 MutationStore.prototype.initMutation = function (mutationId, mutation, variables) {
14 this.store[mutationId] = {
15 mutation: mutation,
16 variables: variables || {},
17 loading: true,
18 error: null,
19 };
20 };
21 MutationStore.prototype.markMutationError = function (mutationId, error) {
22 var mutation = this.store[mutationId];
23 if (mutation) {
24 mutation.loading = false;
25 mutation.error = error;
26 }
27 };
28 MutationStore.prototype.markMutationResult = function (mutationId) {
29 var mutation = this.store[mutationId];
30 if (mutation) {
31 mutation.loading = false;
32 mutation.error = null;
33 }
34 };
35 MutationStore.prototype.reset = function () {
36 this.store = {};
37 };
38 return MutationStore;
39}());
40exports.MutationStore = MutationStore;
41//# sourceMappingURL=mutations.js.map
\No newline at end of file