first commit

This commit is contained in:
Adrian Zürcher
2025-10-12 14:56:18 +02:00
parent a9f2e11fe6
commit a908db4f38
92 changed files with 13273 additions and 0 deletions

23
src/boot/auth.ts Normal file
View File

@@ -0,0 +1,23 @@
import { boot } from 'quasar/wrappers';
import { appApi } from './axios';
import { createPinia } from 'pinia';
import { useUserStore } from 'src/vueLib/login/userStore';
import { useLogin } from 'src/vueLib/login/useLogin';
const pinia = createPinia();
export default boot(async ({ app }) => {
app.use(pinia);
const useStore = useUserStore();
const login = useLogin();
await appApi
.get('/login/me')
.then((resp) => {
useStore.setUser({ username: resp.data.username, role: resp.data.role });
login.refresh().catch((err) => console.error(err));
})
.catch(() => {
login.logout().catch((err) => console.error(err));
});
});