Solves option importer not being passed to api query.

This commit is contained in:
Mateus Machado Luna 2018-07-10 14:45:05 -03:00
parent f9b04440cf
commit 4add863f81
3 changed files with 6 additions and 4 deletions

View File

@ -408,13 +408,14 @@ export default {
let formElement = document.getElementById('importerOptionsForm');
let formData = new FormData(formElement);
let formObj = {};
for (let [key, value] of formData.entries())
formObj[key] = value;
this.updateImporterOptions({ sessionId: this.sessionId, optionsForm: formObj })
.then(updatedImporter => {
this.importer = updatedImporter;
this.finishRunImporter();
})
.catch((errors) => {

View File

@ -60,7 +60,7 @@ class REST_Importers_Controller extends REST_Controller {
'description' => __( 'The array describing the destination collectino as expected by the importer', 'tainacan' ),
],
'options' => [
'type' => 'array',
'type' => 'array/object',
'description' => __( 'The importer options', 'tainacan' ),
]
],

View File

@ -95,10 +95,11 @@ export const updateImporterURL = ( { commit }, { sessionId, url }) => {
});
};
export const updateImporterOptions = ( { commit }, { sessionId, options }) => {
export const updateImporterOptions = ( { commit }, { sessionId, optionsForm }) => {
return new Promise(( resolve, reject ) => {
axios.tainacan.put('importers/session/' + sessionId, {
options: options
options: optionsForm
})
.then( res => {
let importer = res.data;