pocketbase login

This commit is contained in:
2023-09-20 17:03:50 +02:00
parent 6a675c28bc
commit d64cb69f1e
9 changed files with 116 additions and 14 deletions

View File

@@ -1,15 +1,25 @@
import { providePocketBase } from '@/pocketbase';
import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import App from './App.vue';
import { routes } from './routes';
import './style.css';
const app = createApp(App);
const pb = providePocketBase(app);
const router = createRouter({
history: createWebHistory(),
routes,
});
const app = createApp(App);
router.beforeEach(async to => {
if (!pb.authStore.isValid && to.name !== 'login') {
return { name: 'login' };
} else if (pb.authStore.isValid && to.name === 'login') {
return { name: 'home' };
}
});
app.use(router);
app.mount('#app');