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

fix upload image function

parent 831cfb88
......@@ -12,7 +12,7 @@
<!-- create modal -->
<b-modal id="modal-create" title="Create Category" class="modal fade" >
<p class="my-4">
<form @submit.prevent="" >
<form @submit.prevent="createCategory" >
<label>Name :</label>
<input
type="text"
......@@ -302,23 +302,26 @@ export default {
ordering: this.ordering,
parent_id: this.parent_id,
image: this.image,
}, {
headers: {
"Content-Type": "multipart/form-data",
"Authorization": "bearer " + this.$auth.$storage.getUniversal("token")
}
})
.then(response => {
// $bvModal.hide('modal-login');
self.$toast.success('Category created successfully!',{
duration: 3000
});
console.log(response);
this.$bvModal.hide('modal-create')
self.$toast.success('Category created successfully!', {
duration: 3000
})
})
.catch(errors => {
this.$bvModal.hide('modal-create')
console.log(errors.response.data.message);
this.message = errors.response.data.message;
self.$toast.error('something went wrong while trying create!',{
duration: 3000
});
duration: 3000
});
});
},
fileSelected(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