Skip to content

Commit a64d226

Browse files
committed
Add config prop to VueCsvSubmit.vue
1 parent 30ef278 commit a64d226

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

src/components/VueCsvSubmit.vue

+35-30
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,44 @@
77
</template>
88

99
<script>
10-
import {inject} from 'vue';
11-
import axios from 'axios';
10+
import {inject} from 'vue';
11+
import axios from 'axios';
1212
13-
export default {
14-
name: "VueCsvImportSubmit",
15-
props: {
16-
url: {
17-
type: String,
18-
required: true,
19-
}
13+
export default {
14+
name: "VueCsvImportSubmit",
15+
props: {
16+
url: {
17+
type: String,
18+
required: true,
2019
},
21-
setup(props) {
22-
const VueCsvImportData = inject('VueCsvImportData');
23-
const buildMappedCsv = inject('buildMappedCsv');
24-
const labels = VueCsvImportData.language;
20+
config: {
21+
type: Object,
22+
required: false,
23+
default: {}
24+
}
25+
},
26+
setup(props) {
27+
const VueCsvImportData = inject('VueCsvImportData');
28+
const buildMappedCsv = inject('buildMappedCsv');
29+
const labels = VueCsvImportData.language;
2530
26-
const submit = function () {
27-
buildMappedCsv();
31+
const submit = function () {
32+
buildMappedCsv();
2833
29-
axios.post(props.url, {[VueCsvImportData.inputName]: VueCsvImportData.value}).then(response => {
30-
emit('send-success', response);
31-
}).catch(response => {
32-
emit('send-error', response);
33-
}).finally(response => {
34-
emit('send-complete', response);
35-
});
36-
};
34+
axios.post(props.url, {[VueCsvImportData.inputName]: VueCsvImportData.value}, props.config).then(response => {
35+
emit('send-success', response);
36+
}).catch(response => {
37+
emit('send-error', response);
38+
}).finally(response => {
39+
emit('send-complete', response);
40+
});
41+
};
3742
38-
return {
39-
submit,
40-
VueCsvImportData,
41-
labels
42-
}
43-
},
44-
};
43+
return {
44+
submit,
45+
VueCsvImportData,
46+
labels
47+
}
48+
},
49+
};
4550
</script>

0 commit comments

Comments
 (0)