admin-profile.component.js 951 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict'
  2. export default {
  3. name: 'admin-profile',
  4. props: ['email', 'name', 'provider'],
  5. data() {
  6. return {
  7. password: '********',
  8. passwordVerify: '********'
  9. }
  10. },
  11. methods: {
  12. saveUser() {
  13. let self = this
  14. if (this.password !== this.passwordVerify) {
  15. return self.$store.dispatch('alert', {
  16. style: 'red',
  17. icon: 'square-cross',
  18. msg: 'The passwords don\'t match. Try again.'
  19. })
  20. }
  21. this.$http.post(window.location.href, {
  22. password: this.password,
  23. name: this.name
  24. }).then(resp => {
  25. self.$store.dispatch('alert', {
  26. style: 'green',
  27. icon: 'check',
  28. msg: 'Changes have been applied successfully.'
  29. })
  30. }).catch(err => {
  31. self.$store.dispatch('alert', {
  32. style: 'red',
  33. icon: 'square-cross',
  34. msg: 'Error: ' + err.body.msg
  35. })
  36. })
  37. }
  38. }
  39. }