Initial commit, basic pages and sessions.
This commit is contained in:
18
stores/user.js
Normal file
18
stores/user.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user