wikijs-fork/client/js/pages/admin-profile.component.js

41 lines
951 B
JavaScript
Raw Normal View History

2017-05-21 03:21:16 +00:00
'use strict'
export default {
name: 'admin-profile',
props: ['email', 'name', 'provider'],
data() {
return {
password: '********',
passwordVerify: '********'
}
},
methods: {
saveUser() {
let self = this
2017-05-21 03:21:16 +00:00
if (this.password !== this.passwordVerify) {
return self.$store.dispatch('alert', {
style: 'red',
icon: 'square-cross',
msg: 'The passwords don\'t match. Try again.'
})
2017-05-21 03:21:16 +00:00
}
this.$http.post(window.location.href, {
2017-05-21 03:21:16 +00:00
password: this.password,
name: this.name
}).then(resp => {
self.$store.dispatch('alert', {
style: 'green',
icon: 'check',
msg: 'Changes have been applied successfully.'
})
}).catch(err => {
self.$store.dispatch('alert', {
style: 'red',
icon: 'square-cross',
msg: 'Error: ' + err.body.msg
})
2017-05-21 03:21:16 +00:00
})
}
}
}