2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
2022-11-08 16:44:04 +00:00
|
|
|
<div>
|
|
|
|
<h3 class="font-semibold text-2xl text-gray-900">Profile details</h3>
|
|
|
|
<small class="text-gray-600">Update your username and manage your account details.</small>
|
|
|
|
|
|
|
|
<form @submit.prevent="update" @keydown="form.onKeydown($event)" class="mt-3">
|
2022-09-20 19:59:52 +00:00
|
|
|
<alert-success class="mb-5" :form="form" :message="$t('info_updated')" />
|
|
|
|
|
|
|
|
<!-- Name -->
|
|
|
|
<text-input name="name" :form="form" :label="$t('name')" :required="true" />
|
|
|
|
|
|
|
|
<!-- Email -->
|
|
|
|
<text-input name="email" :form="form" :label="$t('email')" :required="true" />
|
|
|
|
|
|
|
|
<!-- Submit Button -->
|
2022-11-08 16:44:04 +00:00
|
|
|
<v-button :loading="form.busy" class="mt-4">Save changes</v-button>
|
2022-09-20 19:59:52 +00:00
|
|
|
</form>
|
2022-11-08 16:44:04 +00:00
|
|
|
</div>
|
2022-09-20 19:59:52 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Form from 'vform'
|
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
scrollToTop: false,
|
|
|
|
|
|
|
|
metaInfo () {
|
|
|
|
return { title: this.$t('settings') }
|
|
|
|
},
|
|
|
|
|
|
|
|
data: () => ({
|
|
|
|
form: new Form({
|
|
|
|
name: '',
|
|
|
|
email: ''
|
|
|
|
})
|
|
|
|
}),
|
|
|
|
|
|
|
|
computed: mapGetters({
|
|
|
|
user: 'auth/user'
|
|
|
|
}),
|
|
|
|
|
|
|
|
created () {
|
|
|
|
// Fill the form with user data.
|
|
|
|
this.form.keys().forEach(key => {
|
|
|
|
this.form[key] = this.user[key]
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async update () {
|
|
|
|
const { data } = await this.form.patch('/api/settings/profile')
|
|
|
|
|
|
|
|
this.$store.dispatch('auth/updateUser', { user: data })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|