index.js 627 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { createStore, createLogger } from 'vuex'
  2. import * as getters from './getters'
  3. import * as actions from './actions'
  4. import mutations from './mutations'
  5. const state = {
  6. currentThreadID: null,
  7. threads: {
  8. /*
  9. id: {
  10. id,
  11. name,
  12. messages: [...ids],
  13. lastMessage
  14. }
  15. */
  16. },
  17. messages: {
  18. /*
  19. id: {
  20. id,
  21. threadId,
  22. threadName,
  23. authorName,
  24. text,
  25. timestamp,
  26. isRead
  27. }
  28. */
  29. }
  30. }
  31. export default createStore({
  32. state,
  33. getters,
  34. actions,
  35. mutations,
  36. plugins: process.env.NODE_ENV !== 'production'
  37. ? [createLogger()]
  38. : []
  39. })