31 lines
520 B
TypeScript
31 lines
520 B
TypeScript
|
import { getterTree, mutationTree, actionTree } from 'typed-vuex'
|
||
|
|
||
|
export const namespaced = true
|
||
|
|
||
|
interface Message {
|
||
|
id: string
|
||
|
content: string
|
||
|
created: Date
|
||
|
}
|
||
|
|
||
|
export const state = () => ({
|
||
|
messages: [] as Message[],
|
||
|
})
|
||
|
|
||
|
export const getters = getterTree(state, {
|
||
|
//
|
||
|
})
|
||
|
|
||
|
export const mutations = mutationTree(state, {
|
||
|
addMessage(state, message: Message) {
|
||
|
state.messages = state.messages.concat([message])
|
||
|
},
|
||
|
})
|
||
|
|
||
|
export const actions = actionTree(
|
||
|
{ state, getters, mutations },
|
||
|
{
|
||
|
//
|
||
|
},
|
||
|
)
|