1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-14 06:10:28 +05:30
Piped/src/router/router.js

69 lines
1.8 KiB
JavaScript
Raw Normal View History

import { createRouter, createWebHistory } from "vue-router";
2020-12-09 19:03:29 +05:30
const routes = [
{
path: "/",
name: "Trending",
component: () => import("../components/TrendingPage.vue"),
},
{
path: "/preferences",
name: "Preferences",
component: () => import("../components/Preferences.vue"),
},
{
path: "/results",
name: "SearchResults",
component: () => import("../components/SearchResults.vue"),
},
{
path: "/playlist",
name: "Playlist",
component: () => import("../components/Playlist.vue"),
},
2021-06-26 15:49:10 +05:30
{
path: "/:path(v|w|embed|shorts|watch)/:v?",
name: "WatchVideo",
2021-06-26 15:49:10 +05:30
component: () => import("../components/WatchVideo.vue"),
},
{
path: "/:path(channel|user|c)/:channelId/:videos?",
name: "Channel",
2021-06-26 15:49:10 +05:30
component: () => import("../components/Channel.vue"),
},
{
path: "/login",
name: "Login",
component: () => import("../components/LoginPage.vue"),
},
{
path: "/register",
name: "Register",
component: () => import("../components/RegisterPage.vue"),
},
{
path: "/feed",
name: "Feed",
component: () => import("../components/FeedPage.vue"),
},
{
path: "/import",
name: "Import",
component: () => import("../components/ImportPage.vue"),
},
{
path: "/:videoId([a-zA-Z0-9_-]{11})",
component: () => import("../components/VideoRedirect.vue"),
},
];
2020-12-09 19:03:29 +05:30
const router = createRouter({
history: createWebHistory(),
routes,
scrollBehavior: function(_to, _from, savedPosition) {
return savedPosition ? savedPosition : window.scrollTo(0, 0);
},
});
2020-12-09 19:03:29 +05:30
export default router;