Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/client/src/store/chat.ts

31 lines
520 B
TypeScript
Raw Normal View History

2020-01-21 03:36:18 +13:00
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 },
{
//
},
)