Set up the Start view

This commit is contained in:
Bubka
2023-10-09 13:00:56 +02:00
parent bde05233c5
commit c389378dc3
5 changed files with 172 additions and 14 deletions

View File

@ -210,12 +210,12 @@ class Form {
* @param {Object} config (axios config)
* @return {Promise}
*/
upload (url, formData, config = {}) {
upload (url, config = {}) {
this.startProcessing()
return new Promise((resolve, reject) => {
// (Form.axios || axios).request({ url: this.route(url), method, data, ...config })
this.axios.request({ url: this.route(url), method: 'post', data: formData, header: {'Content-Type' : 'multipart/form-data'}, ...config })
// https://www.npmjs.com/package/axios#-automatic-serialization-to-formdata
this.axios.post(this.route(url), this.data(), { headers: {'Content-Type' : 'multipart/form-data'}, ...config })
.then(response => {
this.finishProcessing()
@ -227,9 +227,9 @@ class Form {
if (error.response) {
this.errors.set(this.extractErrors(error.response))
}
if (error.response?.status != 422) {
// if (error.response?.status != 422) {
reject(error)
}
// }
})
})
}