mirror of
https://github.com/CamHenlin/MessagesForMacintosh.git
synced 2024-11-26 05:49:24 +00:00
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
"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
|