Commit a802f028 authored by vietanh-0511's avatar vietanh-0511

fix bug parent_id and images

parent 3a409ea6
......@@ -139,6 +139,7 @@
prepend-icon="mdi-camera"
/>
</v-col>
<v-img v-if="typeof eImage === 'string'" :src="eImage" />
</v-row>
</v-container>
<small>*indicates required field</small>
......@@ -248,7 +249,7 @@ export default {
middleware: ['web'],
data: () => {
return {
parent_id: null,
parent_id: '',
name: '',
ordering: '',
image: null,
......@@ -385,14 +386,12 @@ export default {
})
},
createCategory () {
const set = new Set([this.image])
const image = Array.from(set)
const self = this
const fd = new FormData()
fd.append('name', this.name)
fd.append('ordering', this.ordering)
fd.append('parent_id', this.parent_id)
fd.append('images', image)
fd.append('images', this.image)
this.$axios
.post('/categories/',
fd,
......@@ -463,14 +462,16 @@ export default {
console.log(item)
},
updateCategory (userID) {
const set = new Set([this.eImage])
const image = Array.from(set)
const self = this
const fd = new FormData()
if (this.eParentId === null) {
fd.append('parent_id', '')
} else {
fd.append('parent_id', this.eParentId)
}
fd.append('name', this.eName)
fd.append('ordering', this.eOrdering)
fd.append('parent_id', this.eParentId)
fd.append('images', image)
fd.append('images', this.eImage)
try {
this.$axios
.post(`categories/update/${this?.eID}`,
......
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