edit cooperative page and functionality
This commit is contained in:
@@ -6,12 +6,14 @@
|
||||
<h1 class="title">Editar perfil</h1>
|
||||
<FormInput
|
||||
v-model="form.full_name"
|
||||
:value="form.full_name ? form.full_name : ''"
|
||||
type="text"
|
||||
label-text="Nombre de usuario"
|
||||
@input="form.full_name = $event"
|
||||
/>
|
||||
<FormInput
|
||||
v-model="form.email"
|
||||
:value="form.email ? form.email : ''"
|
||||
type="text"
|
||||
label-text="Email"
|
||||
@input="form.email = $event"
|
||||
@@ -55,26 +57,28 @@ export default {
|
||||
success: false,
|
||||
}
|
||||
},
|
||||
async fetch() {
|
||||
computed: {
|
||||
...mapState(useAuthStore, ['id', 'access']),
|
||||
},
|
||||
async created() {
|
||||
const config = useRuntimeConfig()
|
||||
try {
|
||||
await $fetch(`/my_user/`, {
|
||||
const response = await $fetch(`/my_user/`, {
|
||||
baseURL: config.public.baseURL,
|
||||
method: 'GET',
|
||||
body: JSON.stringify(this.form),
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.access}`
|
||||
}
|
||||
})
|
||||
//console.log('User data fetched successfully:', response)
|
||||
this.form.full_name = response.full_name
|
||||
this.form.email = response.email
|
||||
this.form.notify = response.notify
|
||||
} catch (err) {
|
||||
console.error('Error fetching user data:', err)
|
||||
this.error = true
|
||||
return
|
||||
}
|
||||
this.form.full_name = response.full_name
|
||||
this.form.email = response.email
|
||||
this.form.notify = response.notify
|
||||
},
|
||||
computed: {
|
||||
...mapState(useAuthStore, ['id', 'access']),
|
||||
},
|
||||
methods: {
|
||||
...mapActions( useAuthStore, ['setUser']),
|
||||
|
||||
Reference in New Issue
Block a user