UNPKG

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