Created services shorthand helpers

This commit is contained in:
Kylart 2019-10-07 18:44:44 +02:00
parent 0e3c99e532
commit ffb4c75aeb
2 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,4 @@
export { default as global } from './global'
export { default as localLists } from './localLists'
export { default as services } from './services'

View File

@ -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<providerName>
state: [
...providers.map(({ value }) => value)
]
}
)