shack/stores/user.js

19 lines
286 B
JavaScript

import { defineStore } from 'pinia';
import { get } from '../assets/js/api';
async function fetchUser() {
const user = await get('/api/session');
this.user = user;
}
export const useUser = defineStore('user', {
state: () => ({
user: null,
}),
actions: {
fetchUser,
},
});