gancio-upstream/pages/settings.vue

61 lines
1.8 KiB
Vue
Raw Normal View History

2019-04-26 23:14:43 +02:00
<template lang="pug">
2022-07-01 15:55:09 +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-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: '',
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('/')
}
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>