Files
botfights/frontend/src/router.ts
T

108 lines
2.4 KiB
TypeScript
Raw Normal View History

import { createRouter, createWebHistory } from 'vue-router'
const routes = [
{
path: '/',
name: 'home',
component: () => import('./pages/HomePage.vue'),
},
{
path: '/arena',
name: 'arena',
component: () => import('./pages/ArenaPage.vue'),
},
{
path: '/fight-card',
name: 'fight-card',
component: () => import('./pages/FightCardPage.vue'),
},
{
path: '/arena/:fightId',
name: 'fight',
component: () => import('./pages/FightPage.vue'),
},
{
path: '/leaderboard',
name: 'leaderboard',
component: () => import('./pages/LeaderboardPage.vue'),
},
{
path: '/bot/:name',
name: 'bot-profile',
component: () => import('./pages/BotProfilePage.vue'),
},
{
path: '/play/:fightId',
name: 'human-fight',
component: () => import('./pages/HumanFightPage.vue'),
},
{
path: '/register',
name: 'register',
component: () => import('./pages/RegisterPage.vue'),
},
{
path: '/join',
name: 'join-bout',
component: () => import('./pages/JoinBoutPage.vue'),
},
{
path: '/schedule',
name: 'schedule',
component: () => import('./pages/SchedulePage.vue'),
},
{
path: '/sprites',
name: 'sprites',
component: () => import('./pages/SpritePreviewPage.vue'),
},
{
path: '/docs',
name: 'docs',
component: () => import('./pages/DocsPage.vue'),
},
{
path: '/soundboard',
name: 'soundboard',
component: () => import('./pages/SoundboardPage.vue'),
},
2026-03-08 19:48:27 +00:00
{
path: '/feed',
name: 'feed',
component: () => import('./pages/FeedPage.vue'),
},
2026-03-08 21:00:48 +00:00
{
path: '/tournaments',
name: 'tournaments',
component: () => import('./pages/TournamentListPage.vue'),
},
{
path: '/tournament/:id',
name: 'tournament',
component: () => import('./pages/TournamentPage.vue'),
},
2026-03-08 21:07:09 +00:00
{
path: '/practice',
name: 'practice',
component: () => import('./pages/PracticePage.vue'),
},
2026-03-09 00:12:36 +00:00
{
path: '/admin',
name: 'admin',
component: () => import('./pages/AdminPage.vue'),
},
]
export const router = createRouter({
history: createWebHistory(),
routes,
})
// Handle stale chunk 404s after deploy — force reload to get new assets
router.onError((err, to) => {
if (err.message.includes('Failed to fetch dynamically imported module') ||
err.message.includes('Importing a module script failed')) {
window.location.assign(to.fullPath)
}
})