2026-07-10 19:06:43 +00:00
|
|
|
import { createRouter, createWebHistory } from 'vue-router';
|
|
|
|
|
import { useAuthStore } from './stores/auth';
|
|
|
|
|
|
|
|
|
|
export const router = createRouter({
|
|
|
|
|
history: createWebHistory(),
|
|
|
|
|
routes: [
|
|
|
|
|
{ path: '/login', component: () => import('./views/LoginView.vue') },
|
|
|
|
|
{ path: '/', component: () => import('./views/HomeView.vue') },
|
|
|
|
|
{ path: '/upload', component: () => import('./views/wizard/EpisodeWizard.vue') },
|
|
|
|
|
{ path: '/live', component: () => import('./views/wizard/LiveWizard.vue') },
|
|
|
|
|
{ path: '/streams/:id', component: () => import('./views/StreamDashboard.vue') },
|
2026-07-29 12:43:46 +00:00
|
|
|
{ path: '/podcasts/:id/episodes/:eid', component: () => import('./views/EpisodeDetailView.vue') },
|
|
|
|
|
{ path: '/earnings', component: () => import('./views/EarningsView.vue') },
|
2026-07-10 19:06:43 +00:00
|
|
|
{ path: '/settings', component: () => import('./views/SettingsView.vue') },
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
router.beforeEach(async (to) => {
|
|
|
|
|
const auth = useAuthStore();
|
|
|
|
|
await auth.ensureLoaded();
|
|
|
|
|
if (to.path !== '/login' && !auth.pubkey) return '/login';
|
|
|
|
|
if (to.path === '/login' && auth.pubkey) return '/';
|
|
|
|
|
});
|