Commit ef2d4838 authored by Le Dinh Trung's avatar Le Dinh Trung

fix upload image function

parent 831cfb88
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<!-- create modal --> <!-- create modal -->
<b-modal id="modal-create" title="Create Category" class="modal fade" > <b-modal id="modal-create" title="Create Category" class="modal fade" >
<p class="my-4"> <p class="my-4">
<form @submit.prevent="" > <form @submit.prevent="createCategory" >
<label>Name :</label> <label>Name :</label>
<input <input
type="text" type="text"
...@@ -302,13 +302,17 @@ export default { ...@@ -302,13 +302,17 @@ export default {
ordering: this.ordering, ordering: this.ordering,
parent_id: this.parent_id, parent_id: this.parent_id,
image: this.image, image: this.image,
}, {
headers: {
"Content-Type": "multipart/form-data",
"Authorization": "bearer " + this.$auth.$storage.getUniversal("token")
}
}) })
.then(response => { .then(response => {
// $bvModal.hide('modal-login'); this.$bvModal.hide('modal-create')
self.$toast.success('Category created successfully!',{ self.$toast.success('Category created successfully!', {
duration: 3000 duration: 3000
}); })
console.log(response);
}) })
.catch(errors => { .catch(errors => {
this.$bvModal.hide('modal-create') this.$bvModal.hide('modal-create')
...@@ -318,7 +322,6 @@ export default { ...@@ -318,7 +322,6 @@ export default {
duration: 3000 duration: 3000
}); });
}); });
}, },
fileSelected(event){ fileSelected(event){
console.log(event) console.log(event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment