refactor: alerts + admin profile + user create dialog as Vue components
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
import * as $ from 'jquery'
|
||||
|
||||
export default {
|
||||
name: 'admin-profile',
|
||||
props: ['email', 'name', 'provider'],
|
||||
@@ -13,17 +11,29 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
saveUser() {
|
||||
let self = this
|
||||
if (this.password !== this.passwordVerify) {
|
||||
//alerts.pushError('Error', "Passwords don't match!")
|
||||
return
|
||||
return self.$store.dispatch('alert', {
|
||||
style: 'red',
|
||||
icon: 'square-cross',
|
||||
msg: 'The passwords don\'t match. Try again.'
|
||||
})
|
||||
}
|
||||
$.post(window.location.href, {
|
||||
this.$http.post(window.location.href, {
|
||||
password: this.password,
|
||||
name: this.name
|
||||
}).done((resp) => {
|
||||
//alerts.pushSuccess('Saved successfully', 'Changes have been applied.')
|
||||
}).fail((jqXHR, txtStatus, resp) => {
|
||||
//alerts.pushError('Error', resp)
|
||||
}).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
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -7,9 +7,7 @@ import _ from 'lodash'
|
||||
import Vue from 'vue'
|
||||
|
||||
module.exports = (alerts) => {
|
||||
if ($('#page-type-admin-users').length) {
|
||||
require('../modals/admin-users-create.js')(alerts)
|
||||
} else if ($('#page-type-admin-users-edit').length) {
|
||||
if ($('#page-type-admin-users-edit').length) {
|
||||
let vueEditUser = new Vue({
|
||||
el: '#page-type-admin-users-edit',
|
||||
data: {
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
import $ from 'jquery'
|
||||
import MathJax from 'mathjax'
|
||||
// import * as CopyPath from '../components/copy-path.vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
module.exports = (alerts) => {
|
||||
if ($('#page-type-view').length) {
|
||||
|
Reference in New Issue
Block a user