feat(userStore): añadido almacenamiento de los datos de un usuario

parent 555f28da
Showing with 22 additions and 0 deletions
import { defineStore } from 'pinia';
import { userService } from '@/services/user';
export const useUserStore = defineStore('user', {
state: () => ({
user: null,
}),
actions: {
async readUser() {
try {
const userData = await userService.readUser();
this.user = userData;
} catch (error) {
console.error('Error al obtener los datos del usuario:', error);
this.user = null;
throw error;
}
}
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment