add getCollectionCommentStatus helper for Item edit/View

This commit is contained in:
Jacson Passold 2018-08-21 01:39:35 -03:00
parent 1e52496dfe
commit d21ace3542
4 changed files with 28 additions and 1 deletions

View File

@ -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) =>{

View File

@ -25,3 +25,7 @@ export const getCollectionURL = state => {
export const getAttachments = state => {
return state.attachments;
}
export const getCollectionCommentStatus = state => {
return state.collectionCommentStatus;
}

View File

@ -10,7 +10,8 @@ const state = {
collection: null,
collectionName: '',
collectionURL: '',
attachments: []
attachments: [],
collectionCommentStatus: ''
};
export default {

View File

@ -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 = '';
}