2019-04-26 23:14:43 +02:00
|
|
|
<template lang="pug">
|
2020-10-09 00:42:03 +02:00
|
|
|
v-container
|
|
|
|
v-card
|
|
|
|
v-card-title.text-h5 {{$auth.user.email}}
|
|
|
|
v-card-text
|
|
|
|
p {{$t('settings.remove_account')}}
|
|
|
|
v-btn.black--text(color='warning' @click='remove_account') {{$t('common.remove')}}
|
2019-04-26 23:14:43 +02:00
|
|
|
</template>
|
|
|
|
<script>
|
2020-01-15 23:51:09 +01:00
|
|
|
import { mapState } from 'vuex'
|
2019-06-11 17:44:11 +02:00
|
|
|
|
2019-04-26 23:14:43 +02:00
|
|
|
export default {
|
2019-09-11 19:12:24 +02:00
|
|
|
name: 'Settings',
|
2020-01-15 23:51:09 +01:00
|
|
|
middleware: ['auth'],
|
2019-04-26 23:14:43 +02:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
password: '',
|
2019-09-11 11:58:42 +02:00
|
|
|
user: { }
|
2019-04-26 23:14:43 +02:00
|
|
|
}
|
|
|
|
},
|
2021-10-20 14:11:21 +02:00
|
|
|
computed: mapState(['settings']),
|
2019-04-26 23:14:43 +02:00
|
|
|
methods: {
|
2020-01-15 23:51:09 +01:00
|
|
|
// async change_password () {
|
|
|
|
// if (!this.password) { return }
|
|
|
|
// const user_data = { id: this.$auth.user.id, password: this.password }
|
|
|
|
// try {
|
|
|
|
// await this.$axios.$put('/user', user_data)
|
|
|
|
// Message({ message: this.$t('settings.password_updated'), showClose: true, type: 'success' })
|
|
|
|
// this.$router.replace('/')
|
|
|
|
// } catch (e) {
|
|
|
|
// console.log(e)
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// update_settings () {
|
|
|
|
// MessageBox.confirm(this.$t('settings.update_confirm'),
|
|
|
|
// this.$t('common.confirm'), {
|
|
|
|
// confirmButtonText: this.$t('common.ok'),
|
|
|
|
// cancelButtonText: this.$t('common.cancel'),
|
|
|
|
// type: 'error'
|
|
|
|
// }).then(async () => {
|
|
|
|
// this.user = await this.$axios.$put('/user', { ...this.user, password: this.password })
|
|
|
|
// }).catch(e => {
|
|
|
|
// Message({ message: e, showClose: true, type: 'warning' })
|
|
|
|
// })
|
|
|
|
// },
|
2020-10-07 13:05:19 +02:00
|
|
|
async remove_account () {
|
|
|
|
const ret = await this.$root.$confirm('settings.remove_account_confirm', { color: 'error' })
|
|
|
|
if (!ret) return
|
|
|
|
this.$axios.$delete('/user')
|
|
|
|
this.$auth.logout()
|
|
|
|
this.$router.replace('/')
|
2019-06-21 23:52:18 +02:00
|
|
|
}
|
2020-01-15 23:51:09 +01:00
|
|
|
},
|
|
|
|
head () {
|
|
|
|
return {
|
|
|
|
title: `${this.settings.title} - ${this.$t('common.settings')}`
|
|
|
|
}
|
2019-04-26 23:14:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|