traxxx/assets/js/router.js

280 lines
4.8 KiB
JavaScript

import { createRouter, createWebHistory } from 'vue-router';
import Home from '../components/home/home.vue';
import Login from '../components/auth/login.vue';
import Signup from '../components/auth/signup.vue';
import User from '../components/users/user.vue';
import Release from '../components/releases/release.vue';
import Entity from '../components/entities/entity.vue';
import Networks from '../components/networks/networks.vue';
import Actor from '../components/actors/actor.vue';
import Actors from '../components/actors/actors.vue';
import Movies from '../components/releases/movies.vue';
import Notifications from '../components/notifications/notifications.vue';
import Tag from '../components/tags/tag.vue';
import Tags from '../components/tags/tags.vue';
import Stash from '../components/stashes/stash.vue';
import Search from '../components/search/search.vue';
import Stats from '../components/stats/stats.vue';
import NotFound from '../components/errors/404.vue';
const routes = [
{
path: '/',
name: 'home',
redirect: {
name: 'updates',
params: {
range: 'latest',
tags: 'all',
pageNumber: 1,
},
},
},
{
path: '/login',
name: 'login',
component: Login,
},
{
path: '/signup',
name: 'signup',
component: Signup,
},
{
path: '/user/:username',
name: 'user',
component: User,
},
{
path: '/updates',
redirect: {
name: 'updates',
params: {
range: 'latest',
pageNumber: 1,
},
},
},
{
path: '/updates/:range/:pageNumber',
component: Home,
name: 'updates',
},
{
path: '/scene/:releaseId/:releaseSlug?',
component: Release,
name: 'scene',
},
{
path: '/movie/:releaseId/:releaseSlug?',
component: Release,
name: 'movie',
},
{
path: '/serie/:releaseId/:releaseSlug?',
component: Release,
name: 'serie',
},
{
path: '/actor/:actorId/:actorSlug',
name: 'actor',
redirect: (from) => ({
name: 'actorRange',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/actor/:actorId/:actorSlug/:range/:pageNumber',
component: Actor,
name: 'actorRange',
},
{
path: '/director/:actorId/:actorSlug',
name: 'director',
redirect: (from) => ({
name: 'directorRange',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/director/:actorId/:actorSlug',
component: Actor,
name: 'directorRange',
},
{
path: '/channel/:entitySlug',
redirect: (from) => ({
name: 'channel',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/channel/:entitySlug/:range/:pageNumber',
component: Entity,
name: 'channel',
},
{
path: '/network/:entitySlug',
redirect: (from) => ({
name: 'network',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/network/:entitySlug/:range/:pageNumber',
component: Entity,
name: 'network',
},
{
path: '/studio/:entitySlug',
redirect: (from) => ({
name: 'studio',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/studio/:entitySlug/:range/:pageNumber',
component: Entity,
name: 'studio',
},
{
path: '/tag/:tagSlug',
redirect: (from) => ({
name: 'tag',
params: {
...from.params,
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/tag/:tagSlug/:range/:pageNumber',
component: Tag,
name: 'tag',
},
{
path: '/actors',
redirect: (from) => ({
name: 'actors',
params: {
...from.params,
gender: 'all',
tags: 'all',
range: 'latest',
pageNumber: 1,
},
}),
},
{
path: '/actors/:gender?/:pageNumber',
component: Actors,
name: 'actors',
},
{
path: '/channels',
component: Networks,
name: 'channels',
},
{
path: '/movies',
component: Movies,
redirect: {
name: 'movies',
params: {
range: 'latest',
pageNumber: 1,
},
},
},
{
path: '/movies/:range/:pageNumber',
component: Movies,
name: 'movies',
},
{
path: '/tags',
component: Tags,
name: 'tags',
},
{
path: '/notifications',
redirect: {
name: 'notifications',
params: {
pageNumber: 1,
},
},
},
{
path: '/notifications/:pageNumber',
component: Notifications,
name: 'notifications',
},
{
path: '/stash/:stashId/:stashSlug',
redirect: (from) => ({
name: 'stash',
params: {
...from.params,
range: 'scenes',
pageNumber: 1,
},
}),
},
{
path: '/stash/:stashId/:stashSlug?/:range/:pageNumber',
component: Stash,
name: 'stash',
},
{
path: '/search',
component: Search,
name: 'search',
},
{
path: '/stats',
component: Stats,
name: 'stats',
},
{
path: '/not-found',
name: 'not-found',
component: NotFound,
},
{
path: '/:catchAll(.*)',
redirect: {
name: 'not-found',
},
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;