Slightly refactor lists store

This commit is contained in:
Sean King 2023-04-06 22:17:03 -06:00
parent 8eff081468
commit 963e163858
No known key found for this signature in database
GPG Key ID: 510C52BACD6E7257
1 changed files with 104 additions and 110 deletions

View File

@ -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
})