feat: move attachments store to stores
This commit is contained in:
parent
2fd9f0ee47
commit
c2ba1b2828
2 changed files with 0 additions and 2 deletions
|
|
@ -17,7 +17,6 @@ import config from './modules/config'
|
|||
import auth from './modules/auth'
|
||||
import kanban from './modules/kanban'
|
||||
import tasks from './modules/tasks'
|
||||
import attachments from './modules/attachments'
|
||||
|
||||
import ListModel from '@/models/list'
|
||||
|
||||
|
|
@ -40,7 +39,6 @@ export const store = createStore<RootStoreState>({
|
|||
auth,
|
||||
kanban,
|
||||
tasks,
|
||||
attachments,
|
||||
},
|
||||
state: () => ({
|
||||
loading: false,
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
import type { Module } from 'vuex'
|
||||
import {findIndexById} from '@/helpers/utils'
|
||||
|
||||
import type { AttachmentState, RootStoreState } from '@/store/types'
|
||||
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||
|
||||
const store : Module<AttachmentState, RootStoreState> = {
|
||||
namespaced: true,
|
||||
state: () => ({
|
||||
attachments: [],
|
||||
}),
|
||||
mutations: {
|
||||
set(state, attachments: IAttachment[]) {
|
||||
console.debug('Set attachments', attachments)
|
||||
state.attachments = attachments
|
||||
},
|
||||
add(state, attachment: IAttachment) {
|
||||
console.debug('Add attachement', attachment)
|
||||
state.attachments.push(attachment)
|
||||
},
|
||||
removeById(state, id: IAttachment['id']) {
|
||||
const attachmentIndex = findIndexById<IAttachment>(state.attachments, id)
|
||||
state.attachments.splice(attachmentIndex, 1)
|
||||
console.debug('Remove attachement', id)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default store
|
||||
Reference in a new issue