Files
gancio/pages/settings.vue

47 lines
1.1 KiB
Vue
Raw Normal View History

2019-04-26 23:14:43 +02:00
<template lang="pug">
2019-06-07 17:02:33 +02:00
el-card
nuxt-link.float-right(to='/')
v-icon(name='times' color='red')
h5 {{$t('common.settings')}}
2019-05-30 12:04:14 +02:00
//- el-form
//- el-form-item {{$t('settings.change_password')}}
el-divider {{$t('settings.change_password')}}
el-input(v-model='password' type='password')
el-button(slot='append' @click='change' type='success') {{$t('common.send')}}
2019-04-26 23:14:43 +02:00
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
data () {
return {
password: '',
}
},
2019-05-30 12:04:14 +02:00
// computed: mapState(['user']),
// async asyncData ({ $axios, params }) {
// const user = await $axios.$get('/auth/user')
// user.mastodon_auth = ''
// return { user }
// },
2019-04-26 23:14:43 +02:00
methods: {
2019-05-30 12:04:14 +02:00
async change () {
if (!this.password) return
2019-06-07 17:02:33 +02:00
// this.$auth.user.password = this.password
const user_data = { id : this.$auth.user.id, password: this.password }
2019-05-30 12:04:14 +02:00
try {
2019-06-07 17:02:33 +02:00
const user = await this.$axios.$put('/user', user_data)
console.error(user)
2019-05-30 12:04:14 +02:00
} catch (e) {
console.log(e)
}
},
close (done) {
this.$router.back()
done()
2019-04-26 23:14:43 +02:00
}
}
}
</script>