2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
2022-11-08 16:44:04 +00:00
|
|
|
<div>
|
2023-10-14 16:24:44 +00:00
|
|
|
<h3 class="font-semibold text-2xl text-gray-900">
|
|
|
|
Profile details
|
|
|
|
</h3>
|
2022-11-08 16:44:04 +00:00
|
|
|
<small class="text-gray-600">Update your username and manage your account details.</small>
|
|
|
|
|
2023-10-14 16:24:44 +00:00
|
|
|
<form class="mt-3" @submit.prevent="update" @keydown="form.onKeydown($event)">
|
|
|
|
<alert-success class="mb-5" :form="form" message="Your info has been updated!" />
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
<!-- Name -->
|
2023-10-14 16:24:44 +00:00
|
|
|
<text-input name="name" :form="form" label="Name" :required="true" />
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
<!-- Email -->
|
2023-10-14 16:24:44 +00:00
|
|
|
<text-input name="email" :form="form" label="Email" :required="true" />
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
<!-- Submit Button -->
|
2023-10-14 16:24:44 +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'
|
2023-12-01 17:57:14 +00:00
|
|
|
import { computed } from 'vue'
|
|
|
|
import { useAuthStore } from '../../stores/auth'
|
2023-01-21 11:57:37 +00:00
|
|
|
import SeoMeta from '../../mixins/seo-meta.js'
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
export default {
|
2022-12-22 10:55:17 +00:00
|
|
|
mixins: [SeoMeta],
|
2023-10-14 16:24:44 +00:00
|
|
|
scrollToTop: false,
|
2022-09-20 19:59:52 +00:00
|
|
|
|
2023-12-01 17:57:14 +00:00
|
|
|
setup () {
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
return {
|
|
|
|
authStore,
|
|
|
|
user : computed(() => authStore.user)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-09-20 19:59:52 +00:00
|
|
|
data: () => ({
|
2022-12-22 10:55:17 +00:00
|
|
|
metaTitle: 'Profile',
|
2022-09-20 19:59:52 +00:00
|
|
|
form: new Form({
|
|
|
|
name: '',
|
|
|
|
email: ''
|
|
|
|
})
|
|
|
|
}),
|
|
|
|
|
|
|
|
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')
|
|
|
|
|
2023-12-01 17:57:14 +00:00
|
|
|
this.authStore.updateUser(data)
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|