add mapper prop to collection creation actions

This commit is contained in:
Jacson Passold 2018-05-29 20:16:36 -03:00
parent 3beaced591
commit bc99d7eae4
2 changed files with 8 additions and 5 deletions

View File

@ -351,6 +351,7 @@ export default {
formErrorMessage: '',
isNewCollection: false,
isMapped: false,
mapper: false,
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png',
headerPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_rectangle.png',
isFetchingModerators: false,
@ -429,7 +430,7 @@ export default {
this.isLoading = true;
// Creates draft Collection
let data = { name: '', description: '', status: 'auto-draft'};
let data = { name: '', description: '', status: 'auto-draft', mapper: (this.isMapped && this.mapper != false ? this.mapper : false ) };
this.sendCollection(data).then(res => {
this.collectionId = res.id;
@ -642,7 +643,8 @@ export default {
var mapper = tmppath.pop();
if(tmppath.pop() == 'new') {
this.isNewCollection = true;
this.isMapped = mapper;
this.isMapped = true;
this.mapper = mapper;
this.createNewCollection();
}
}

View File

@ -139,15 +139,16 @@ export const updateCollection = ({ commit }, { collection_id, name, description,
});
}
export const sendCollection = ( { commit }, { name, description, status }) => {
export const sendCollection = ( { commit }, { name, description, status, mapper }) => {
return new Promise(( resolve, reject ) => {
axios.tainacan.post('/collections/', {
name: name,
description: description,
status: status
status: status,
'exposer-map': mapper
})
.then( res => {
commit('setCollection', { name: name, description: description, status: status });
commit('setCollection', { name: name, description: description, status: status, mapper: mapper });
resolve( res.data );
})
.catch(error => {