Commit 61121f4f authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'feature/alert' into 'feature/deploy-to-aws'

update error alert message

See merge request !29
parents 43bf84cb 61a8187e
...@@ -542,7 +542,7 @@ export default { ...@@ -542,7 +542,7 @@ export default {
.catch((errors) => { .catch((errors) => {
console.log(errors.response.data.message) console.log(errors.response.data.message)
this.message = errors.response.data.message this.message = errors.response.data.message
self.$toast.error('something went wrong while trying create!', { self.$toast.error(this.message, {
duration: 3000 duration: 3000
}) })
}) })
...@@ -602,26 +602,27 @@ export default { ...@@ -602,26 +602,27 @@ export default {
if (typeof this.eImage !== 'string' && this.eImage != null) { if (typeof this.eImage !== 'string' && this.eImage != null) {
fd.append('image', this.eImage) fd.append('image', this.eImage)
} }
try { this.$axios
this.$axios .post(`categories/update/${this?.eID}`, fd, {
.post(`categories/update/${this?.eID}`, fd, { headers: {
headers: { Authorization: `Bearer ${this.$auth.$storage.getUniversal(
Authorization: `Bearer ${this.$auth.$storage.getUniversal( 'token'
'token' )}`
)}` }
} })
.then((response) => {
self.$toast.success('Category updated successfully!', {
duration: 3000
}) })
.then((response) => { this.editedItem = response.data.data
self.$toast.success('Category updated successfully!', { Object.assign(this.categories[this.editedIndex], this.editedItem)
duration: 3000 this.clearFile()
}) }).catch((errors) => {
this.editedItem = response.data.data this.message = errors.response.data.message
Object.assign(this.categories[this.editedIndex], this.editedItem) self.$toast.error(this.message, {
this.clearFile() duration: 3000
}) })
} catch (error) { })
console.log(error)
}
}, },
clearData () { clearData () {
this.parent_id = '' this.parent_id = ''
......
...@@ -553,7 +553,7 @@ export default { ...@@ -553,7 +553,7 @@ export default {
this.clearFile() this.clearFile()
}) })
.catch((errors) => { .catch((errors) => {
self.$toast.error('something went wrong while trying create!', { self.$toast.error(errors.response.data.message, {
duration: 3000 duration: 3000
}) })
}) })
...@@ -626,7 +626,7 @@ export default { ...@@ -626,7 +626,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
self.$toast.error('something went wrong while trying update!', { self.$toast.error(error.response.data.message, {
duration: 3000 duration: 3000
}) })
}) })
......
...@@ -721,7 +721,7 @@ export default { ...@@ -721,7 +721,7 @@ export default {
.catch((errors) => { .catch((errors) => {
console.log(errors.response.data.message) console.log(errors.response.data.message)
this.message = errors.response.data.message this.message = errors.response.data.message
self.$toast.error('something went wrong while trying create!', { self.$toast.error(errors.response.data.message, {
duration: 3000 duration: 3000
}) })
}) })
...@@ -803,7 +803,7 @@ export default { ...@@ -803,7 +803,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
self.$toast.error('something went wrong while trying update!', { self.$toast.error(error.response.data.message, {
duration: 3000 duration: 3000
}) })
}) })
......
...@@ -403,7 +403,7 @@ export default { ...@@ -403,7 +403,7 @@ export default {
this.validate() this.validate()
console.log(errors.response.data.message) console.log(errors.response.data.message)
this.message = errors.response.data.message this.message = errors.response.data.message
self.$toast.error('something went wrong while trying create!', { self.$toast.error(this.message, {
duration: 3000 duration: 3000
}) })
}) })
...@@ -467,7 +467,7 @@ export default { ...@@ -467,7 +467,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
self.$toast.error('something went wrong while trying update!', { self.$toast.error(this.message, {
duration: 3000 duration: 3000
}) })
}) })
......
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