diff --git a/src/js/store/modules/collection/actions.js b/src/js/store/modules/collection/actions.js index 311782c45..7584a780d 100644 --- a/src/js/store/modules/collection/actions.js +++ b/src/js/store/modules/collection/actions.js @@ -147,6 +147,20 @@ export const fetchCollectionName = ({ commit }, id) => { }); }; +export const fetchCollectionCommentStatus = ({ commit }, id) => { + return new Promise((resolve, reject) =>{ + axios.tainacan.get('/collections/' + id + '?fetch_only=comment_status') + .then(res => { + let collectionCommentStatus = res.data; + commit('setCollectionCommentStatus', collectionCommentStatus.comment_status); + resolve( collectionCommentStatus.comment_status ); + }) + .catch(error => { + reject(error); + }) + }); +}; + export const fetchCollectionNameAndURL = ({ commit }, id) => { //commit('cleanCollectionName'); return new Promise((resolve, reject) =>{ diff --git a/src/js/store/modules/collection/getters.js b/src/js/store/modules/collection/getters.js index 1b120f078..bb72d0a10 100644 --- a/src/js/store/modules/collection/getters.js +++ b/src/js/store/modules/collection/getters.js @@ -25,3 +25,7 @@ export const getCollectionURL = state => { export const getAttachments = state => { return state.attachments; } + +export const getCollectionCommentStatus = state => { + return state.collectionCommentStatus; +} \ No newline at end of file diff --git a/src/js/store/modules/collection/index.js b/src/js/store/modules/collection/index.js index 5da338d87..7692ce1bb 100644 --- a/src/js/store/modules/collection/index.js +++ b/src/js/store/modules/collection/index.js @@ -10,7 +10,8 @@ const state = { collection: null, collectionName: '', collectionURL: '', - attachments: [] + attachments: [], + collectionCommentStatus: '' }; export default { diff --git a/src/js/store/modules/collection/mutations.js b/src/js/store/modules/collection/mutations.js index 10b9aa755..535b9f2dc 100644 --- a/src/js/store/modules/collection/mutations.js +++ b/src/js/store/modules/collection/mutations.js @@ -69,4 +69,12 @@ export const setAttachments = ( state, attachments ) => { export const cleanAttachments = (state) => { state.attachments = []; +} + +export const setCollectionCommentStatus = (state, collectionCommentStatus) => { + state.collectionCommentStatus = collectionCommentStatus; +} + +export const cleanCollectionCommentStatus = (state) => { + state.collectionCommentStatus = ''; } \ No newline at end of file