Commit e6ee12b8 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

remove fetch

parent 81fc4c62
......@@ -117,7 +117,7 @@
type="text"
class="form-control mb-2"
placeholder="Description"
v-model="sUserID"
v-model="sUserId"
size="sm"
disabled
/>
......@@ -279,7 +279,7 @@ export default {
},
{ text: "Category ID", value: "category_id" },
{ text: "content", value: "content", sortable: false },
{ text: "user_id", value: "user_id" },
{ text: "author", value: "user_id" },
{ text: "status", value: "status" },
{ text: "Actions", value: "actions", sortable: false },
],
......@@ -460,21 +460,20 @@ export default {
async showPost(item) {
const ID = item.id
try {
const resp = await fetch(`http://127.0.0.1:8000/api/posts/${ID}`, {
const resp = await this.$axios.get(`/posts/${ID}`, {
method: "GET",
headers: {
"Content-Type": "multipart/form-data",
Authorization: this.$auth.$storage.getUniversal("token"),
},
}).then((response) => {
return response.json()
})
this.sTitle = resp.data.title
this.sContent = resp.data.content
this.sCategoryId = resp.data.category_id
this.sUserId = resp.data.user_id
this.sStatus = resp.data.status
this.sImages = resp.data.images
console.log(resp.data)
this.sTitle = resp.data.data.title
this.sContent = resp.data.data.content
this.sCategoryId = resp.data.data.category_id
this.sUserId = resp.data.data.user_id
this.sStatus = resp.data.data.status
this.sImages = resp.data.data.images
} catch (error) {
console.log(error)
}
......@@ -492,7 +491,7 @@ export default {
},
updatePost() {
const self = this
axios
this.$axios
.post(
`/posts/update/${this?.eId}`,
{
......@@ -532,5 +531,4 @@ export default {
};
</script>
<style>
</style>
<style></style>
......@@ -558,24 +558,20 @@ export default {
async showProduct(item) {
const ID = item.id
try {
const resp = await fetch(`http://127.0.0.1:8000/api/products/${ID}`, {
const resp = await this.$axios.get(`/products/${ID}`, {
method: "GET",
headers: {
"Content-Type": "multipart/form-data",
"Authorization": this.$auth.$storage.getUniversal("token")
}
}).then((response) => {
return response.json()
Authorization: this.$auth.$storage.getUniversal("token"),
},
})
this.sName = resp.data.name
this.sPrice = resp.data.price
this.sCategoryId = resp.data.category_id
this.sDescription = resp.data.description
this.sStock = resp.data.stock
this.sVariants = resp.data.variants
this.sImages = resp.data.images
console.log(this.sVariants)
console.log(this.sImages)
this.sName = resp.data.data.name
this.sPrice = resp.data.data.price
this.sCategoryId = resp.data.data.category_id
this.sDescription = resp.data.data.description
this.sStock = resp.data.data.stock
this.sVariants = resp.data.data.variants
this.sImages = resp.data.data.images
} catch (error) {
console.log(error)
}
......
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