mirror of https://github.com/wg-easy/wg-easy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
402 B
18 lines
402 B
export const useAuthStore = defineStore('Auth', () => {
|
|
const { data: userData, refresh: update } = useFetch('/api/session', {
|
|
method: 'get',
|
|
});
|
|
|
|
async function getSession() {
|
|
try {
|
|
const { data } = await useFetch('/api/session', {
|
|
method: 'get',
|
|
});
|
|
return data.value;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
return { userData, update, getSession };
|
|
});
|
|
|