Commit 661bab10 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'dev' of...

Merge branch 'dev' of https://gitlab.kiaisoft.com/kiaisoft.anh.tran2/kiaisoft_tuananh_nuxt into feature/homepage-header
parents eed1a4b4 d1b0d336
This diff is collapsed.
...@@ -612,7 +612,7 @@ export default { ...@@ -612,7 +612,7 @@ export default {
} }
}) })
.then((response) => { .then((response) => {
self.$toast.success('User updated successfully!', { self.$toast.success('Category updated successfully!', {
duration: 3000 duration: 3000
}) })
this.editedItem = response.data.data this.editedItem = response.data.data
......
...@@ -111,38 +111,30 @@ export default { ...@@ -111,38 +111,30 @@ export default {
}, },
async login () { async login () {
try { try {
const resp = await fetch('http://127.0.0.1:8000/api/login', { const resp = await this.$axios.post('/login',
method: 'POST', {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json'
},
body: JSON.stringify({
email: this.email, email: this.email,
password: this.password, password: this.password,
status: this.status status: this.status
}) })
}).then((response) => { localStorage.setItem('token', resp.data.data.bearer_token)
return response.json() this.$auth.$storage.setUniversal('token', resp.data.data.bearer_token)
}) this.$auth.$storage.setUniversal('userName', resp.data.data.name)
console.log(resp.status)
localStorage.setItem('token', resp.data.bearer_token)
this.$auth.$storage.setUniversal('token', resp.data.bearer_token)
this.$auth.$storage.setUniversal('userName', resp.data.name)
this.$auth.$storage.setUniversal('loggedIn', 'true') this.$auth.$storage.setUniversal('loggedIn', 'true')
if (resp.status == 'success') { if (resp.status === 200) {
this.$toast.success('Successfully authenticated', { this.$toast.success('Successfully authenticated', {
duration: 2000 duration: 2000,
}) });
this.$router.push('home') this.$router.push('home');
} }
} catch (e) { } catch (e) {
this.$toast.error('Username or Password not valid', { this.$toast.error('Username or Password not valid', {
duration: 2000 duration: 2000
}) });
this.$router.push('/login') this.$router.push('/login')
} }
} }
} }
} }
</script> </script>
......
...@@ -106,12 +106,11 @@ ...@@ -106,12 +106,11 @@
</v-col> </v-col>
<v-col cols="12" text-align=" left"> <v-col cols="12" text-align=" left">
<v-img <v-img
v-for="(imageEdit, index) in eImages" v-if="typeof eImages === 'string'"
:key="index"
contain contain
height="100px" height="100px"
width="150px" width="150px"
:src="imageEdit" :src="eImages"
/> />
</v-col> </v-col>
</v-row> </v-row>
...@@ -213,7 +212,6 @@ ...@@ -213,7 +212,6 @@
v-model="category_id" v-model="category_id"
:items="categories" :items="categories"
:search="search" :search="search"
:filter="filter"
item-text="name" item-text="name"
item-value="id" item-value="id"
label="Category" label="Category"
...@@ -630,7 +628,7 @@ export default { ...@@ -630,7 +628,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
self.$toast.error('something went wrong while trying create!', { self.$toast.error('something went wrong while trying update!', {
duration: 3000 duration: 3000
}) })
}) })
...@@ -668,7 +666,7 @@ export default { ...@@ -668,7 +666,7 @@ export default {
padding-left: 90px !important; padding-left: 90px !important;
} }
img { img {
width: 100%; width: 100px;
height: 100%; height: 150px;
} }
</style> </style>
...@@ -761,6 +761,7 @@ export default { ...@@ -761,6 +761,7 @@ export default {
this.eImages = item.images this.eImages = item.images
this.editedIndex = this.products.indexOf(item) this.editedIndex = this.products.indexOf(item)
console.log(item.variants) console.log(item.variants)
console.log(typeof this.eImages)
this.dialog3 = true this.dialog3 = true
}, },
updateProduct (ID) { updateProduct (ID) {
...@@ -784,26 +785,28 @@ export default { ...@@ -784,26 +785,28 @@ export default {
} }
} }
const currentPostIndex = this.editedIndex const currentPostIndex = this.editedIndex
try { this.$axios
this.$axios .post(`/products/update/${this?.eId}`,
.post(`/products/update/${this?.eId}`, fd, {
fd, { headers: {
headers: { Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
}
} }
) }
.then((response) => { )
self.$toast.success('Product updated successfully!', { .then((response) => {
duration: 3000 self.$toast.success('Product updated successfully!', {
}) duration: 3000
console.log(response)
this.editedItem = response.data.data
Object.assign(this.products[currentPostIndex], this.editedItem)
}) })
} catch (error) { console.log(response)
console.log(error) this.editedItem = response.data.data
} Object.assign(this.products[currentPostIndex], this.editedItem)
})
.catch((error) => {
console.log(error)
self.$toast.error('something went wrong while trying update!', {
duration: 3000
})
})
}, },
addMore () { addMore () {
this.variants.push({ this.variants.push({
......
This diff is collapsed.
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