From ffb4c75aeb9adc5bcb1d514836ac126c504b4ccd Mon Sep 17 00:00:00 2001 From: Kylart Date: Mon, 7 Oct 2019 18:44:44 +0200 Subject: [PATCH] Created services shorthand helpers --- src/renderer/store/helpers/index.js | 1 + src/renderer/store/helpers/services.js | 40 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/renderer/store/helpers/services.js diff --git a/src/renderer/store/helpers/index.js b/src/renderer/store/helpers/index.js index 6cfa574..4b14ffb 100644 --- a/src/renderer/store/helpers/index.js +++ b/src/renderer/store/helpers/index.js @@ -1,3 +1,4 @@ export { default as global } from './global' export { default as localLists } from './localLists' +export { default as services } from './services' diff --git a/src/renderer/store/helpers/services.js b/src/renderer/store/helpers/services.js new file mode 100644 index 0000000..2e586c4 --- /dev/null +++ b/src/renderer/store/helpers/services.js @@ -0,0 +1,40 @@ +import { providers } from '../modules/lists' + +import createNamespace from './createNamespace' + +const PREFIX = '__s' +const NAMESPACE = 'services' + +export default createNamespace( + NAMESPACE, + PREFIX, + { + // Brings __sSet, __sHasUser, __sIsConnected, __sGetList, __sUpdateList + // and __sExternal + actions: [ + 'set', + 'hasUser', + 'isConnected', + 'getList', + 'updateList', + 'external' + ], + // Brings __sSetUser, __sHasUser, __sSetValue, __sSetConnected, __sSetLoading, + // __sSetList, __sSetError, __sShowForm and__sSetFormEntry + mutations: [ + 'setUser', + 'hasUser', + 'setValue', + 'setConnected', + 'setLoading', + 'setList', + 'setError', + 'showForm', + 'setFormEntry' + ], + // Brings __s + state: [ + ...providers.map(({ value }) => value) + ] + } +)