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,
	},
});