Skip to content
Snippets Groups Projects
Commit 1a4260c5 authored by Tim Eder's avatar Tim Eder
Browse files

unified eports in store

parent 03f66000
No related branches found
No related tags found
3 merge requests!296Merge develop for staging release,!230Draft: Vuex store refactoring suggestions,!225Draft: Resolve "[Refactoring] Improve vuex store usage"
......@@ -47,7 +47,7 @@ export interface IAppbarStore {
*
* @return {IAppbarStore} the state object
*/
export const state = (): IAppbarStore => {
const state = (): IAppbarStore => {
return {
activeTab: null,
cancelBtnDisabled: false,
......@@ -59,7 +59,7 @@ export const state = (): IAppbarStore => {
}
}
export const mutations = {
const mutations = {
/**
* Sets the title of the AppBar
*
......@@ -141,7 +141,7 @@ type StoreContext = {
dispatch: (action: string, payload: any) => void
}
export const actions = {
const actions = {
/**
* initializes the Appbar
*
......@@ -452,3 +452,10 @@ export const actions = {
context.dispatch('init', state())
}
}
export default {
namespaced: true,
state,
actions,
mutations
}
......@@ -46,7 +46,7 @@ interface contactsState {
totalPages: number
}
export const state = () => ({
const state = () => ({
contacts: [],
contact: null,
configurationContacts: [],
......@@ -54,7 +54,8 @@ export const state = () => ({
pageNumber: 1,
pageSize: 20
})
export const getters = {
const getters = {
searchContacts: (state: contactsState) => {
return state.contacts.filter((c: Contact) => !state.configurationContacts.find((rc: Contact) => rc.id === c.id))
},
......@@ -68,7 +69,7 @@ export const getters = {
}
// @ts-ignore
export const actions: {
const actions: {
[key: string]: any;
$api: Api
} = {
......@@ -126,7 +127,8 @@ export const actions: {
return this.$api.contacts.save(contact)
}
}
export const mutations = {
const mutations = {
setContacts (state: contactsState, contacts: Contact[]) {
state.contacts = contacts
},
......@@ -143,3 +145,11 @@ export const mutations = {
state.totalPages = count
}
}
export default {
namespaced: true,
state,
getters,
actions,
mutations
}
......@@ -33,6 +33,7 @@
import { Commit } from 'vuex'
import { IUploadResult } from '@/services/sms/UploadApi'
import { Api } from '@/services/Api'
const state = () => ({})
const getters = {}
......
......@@ -34,14 +34,14 @@ export interface ISnackbarStore {
success: string
}
export const state = () => {
const state = () => {
return {
error: '',
success: ''
}
}
export const mutations = {
const mutations = {
setError (state: ISnackbarStore, error: string) {
state.error = error
},
......@@ -55,3 +55,9 @@ export const mutations = {
state.success = ''
}
}
export default {
namespaced: true,
state,
mutations
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment