getters.js 341 B

1234567891011121314
  1. export const threads = state => state.threads
  2. export const currentThread = state => {
  3. return state.currentThreadID
  4. ? state.threads[state.currentThreadID]
  5. : {}
  6. }
  7. export const currentMessages = state => {
  8. const thread = currentThread(state)
  9. return thread.messages
  10. ? thread.messages.map(id => state.messages[id])
  11. : []
  12. }