Slightly refactor lists store
This commit is contained in:
parent
8eff081468
commit
963e163858
|
@ -2,12 +2,12 @@ import { defineStore } from 'pinia'
|
|||
|
||||
import { remove, find } from 'lodash'
|
||||
|
||||
export const defaultState = {
|
||||
export const useListsStore = defineStore('lists', {
|
||||
state: () => ({
|
||||
allLists: [],
|
||||
allListsObject: {}
|
||||
}
|
||||
|
||||
export const getters = {
|
||||
}),
|
||||
getters: {
|
||||
findListTitle (state) {
|
||||
return (id) => {
|
||||
if (!this.allListsObject[id]) return
|
||||
|
@ -17,9 +17,8 @@ export const getters = {
|
|||
findListAccounts (state) {
|
||||
return (id) => [...this.allListsObject[id].accountIds]
|
||||
}
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
},
|
||||
actions: {
|
||||
setLists (value) {
|
||||
this.allLists = value
|
||||
},
|
||||
|
@ -108,9 +107,4 @@ export const actions = {
|
|||
remove(this.allLists, list => list.id === listId)
|
||||
}
|
||||
}
|
||||
|
||||
export const useListsStore = defineStore('lists', {
|
||||
state: () => (defaultState),
|
||||
getters,
|
||||
actions
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue