gitlab-org--gitlab-foss/app/assets/javascripts/notes/stores/getters.js
Filipa Lacerda cf5cc6a9cc Follow vuex docs to divide store into: actions, getters and mutations
Use constants for mutation types as per vuex docs
2017-07-25 20:01:53 +01:00

15 lines
318 B
JavaScript

export const notes = state => state.notes;
export const targetNoteHash = state => state.targetNoteHash;
export const notesById = (state) => {
const notesByIdObject = {};
state.notes.forEach((note) => {
note.notes.forEach((n) => {
notesByIdObject[n.id] = n;
});
});
return notesByIdObject;
};