Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- save() {
- const params = new FormData()
- const testimonial = this.testimonial
- for (const field in testimonial) {
- params.append(field, testimonial[field])
- }
- const request = this.id
- ? this.$axios.put(`${this.loadUrl}/${this.id}`, params)
- : this.$axios.post(this.loadUrl, params)
- request
- .then(({ status }) => {
- if (Number(status) === 200) this.success = 'Отзыв успешно обновлён'
- if (Number(status) === 201) this.success = 'Отзыв успешно добавлен'
- setTimeout(() => {
- this.$router.push('/testimonials/')
- }, 1000)
- })
- .catch(error => {
- this.error = error + ''
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement