move routes to separate file and added placeholder and todos

This commit is contained in:
Gamebrary 2021-08-04 22:21:03 -07:00
parent b7d06b44d2
commit f554b3c16b
2 changed files with 211 additions and 163 deletions

View file

@ -1,170 +1,30 @@
import Vue from 'vue';
import Router from 'vue-router';
import BoardPage from '@/pages/BoardPage';
import AboutPage from '@/pages/AboutPage';
import WallpapersPage from '@/pages/WallpapersPage';
import PublicBoardsPage from '@/pages/PublicBoardsPage';
import TagsPage from '@/pages/TagsPage';
import NotesPage from '@/pages/NotesPage';
import ReleasesPage from '@/pages/ReleasesPage';
import AuthPage from '@/pages/AuthPage';
import BoardsPage from '@/pages/BoardsPage';
import PublicProfilesPage from '@/pages/PublicProfilesPage';
import DevToolsPage from '@/pages/DevToolsPage';
// TODO: finish homepage
// import HomePage from '@/pages/HomePage';
import SettingsPage from '@/pages/SettingsPage';
import ProfilePage from '@/pages/ProfilePage';
import EditProfilePage from '@/pages/EditProfilePage';
import PublicProfilePage from '@/pages/PublicProfilePage';
import routes from '@/routes';
import store from '@/store';
Vue.use(Router);
export default new Router({
const router = new Router({
// TODO: enable history mode
// mode: 'history',
routes: [
{
name: 'boards',
path: '/boards',
component: BoardsPage,
meta: {
title: 'Boards',
},
},
{
name: 'profiles',
path: '/profiles',
component: PublicProfilesPage,
meta: {
title: 'Boards',
public: true,
},
},
{
name: 'dev-tools',
path: '/dev-tools',
component: DevToolsPage,
meta: {
title: 'DevTools',
},
},
{
name: 'settings',
path: '/settings',
component: SettingsPage,
meta: {
title: 'Settings',
},
},
{
name: 'wallpapers',
path: '/wallpapers',
component: WallpapersPage,
meta: {
title: 'Wallpapers',
},
},
{
name: 'tags',
path: '/tags',
component: TagsPage,
meta: {
title: 'Tags',
},
},
{
name: 'notes',
path: '/notes',
component: NotesPage,
meta: {
title: 'Notes',
},
},
{
name: 'public-boards',
path: '/public-boards',
component: PublicBoardsPage,
meta: {
title: 'PublicBoards',
public: true,
},
},
{
name: 'profile',
path: '/profile',
component: ProfilePage,
meta: {
title: 'Profile',
},
},
{
name: 'edit-profile',
path: '/EditProfilePage',
component: EditProfilePage,
meta: {
title: 'Edit profile',
},
},
{
name: 'about',
path: '/about',
component: AboutPage,
meta: {
title: 'About',
},
},
{
name: 'releases',
path: '/releases',
component: ReleasesPage,
meta: {
title: 'Releases',
},
},
{
name: 'auth',
path: '/auth',
component: AuthPage,
meta: {
title: 'Auth',
},
children: [
{
name: 'auth-provider',
path: ':provider',
component: AuthPage,
},
],
},
{
path: '/board/:id',
name: 'board',
component: BoardPage,
},
{
path: '/b/:id',
name: 'public-board',
component: BoardPage,
meta: {
public: true,
},
},
{
path: '/:userName',
name: 'public-profile',
component: PublicProfilePage,
meta: {
public: true,
},
},
{
name: 'home',
path: '/',
component: BoardsPage,
meta: {
title: 'Home',
public: true,
},
},
],
routes,
});
// TODO: add navigation guards when trying to access private routes.
// router.beforeEach((to, from, next) => {
// if (to.meta.public || store.state.user) next();
//
// if (!to.meta.public && !store.state.user) {
// console.log('not allowed');
//
// next({ name: 'auth' });
// }
//
// next();
// // if (to.name !== 'Login' && !isAuthenticated) next({ name: 'Login' })
// // else next()
// });
export default router;

188
src/routes.js Normal file
View file

@ -0,0 +1,188 @@
import AboutPage from '@/pages/AboutPage';
import AuthPage from '@/pages/AuthPage';
import BoardPage from '@/pages/BoardPage';
import BoardsPage from '@/pages/BoardsPage';
import DevToolsPage from '@/pages/DevToolsPage';
import EditProfilePage from '@/pages/EditProfilePage';
// import HomePage from '@/pages/HomePage';
import NotFoundPage from '@/pages/NotFoundPage';
import NotesPage from '@/pages/NotesPage';
import ProfilePage from '@/pages/ProfilePage';
import PublicBoardsPage from '@/pages/PublicBoardsPage';
import PublicProfilePage from '@/pages/PublicProfilePage';
import PublicProfilesPage from '@/pages/PublicProfilesPage';
import PrivacyPolicyPage from '@/pages/PrivacyPolicyPage';
import ReleasesPage from '@/pages/ReleasesPage';
import SettingsPage from '@/pages/SettingsPage';
import TagsPage from '@/pages/TagsPage';
import TermsPage from '@/pages/TermsPage';
import WallpapersPage from '@/pages/WallpapersPage';
const routes = [
{
name: 'boards',
path: '/boards',
component: BoardsPage,
meta: {
title: 'Boards',
},
},
{
name: 'profiles',
path: '/profiles',
component: PublicProfilesPage,
meta: {
title: 'Boards',
public: true,
},
},
{
name: 'dev-tools',
path: '/dev-tools',
component: DevToolsPage,
meta: {
title: 'DevTools',
},
},
{
name: 'settings',
path: '/settings',
component: SettingsPage,
meta: {
title: 'Settings',
},
},
{
name: 'wallpapers',
path: '/wallpapers',
component: WallpapersPage,
meta: {
title: 'Wallpapers',
},
},
{
name: 'tags',
path: '/tags',
component: TagsPage,
meta: {
title: 'Tags',
},
},
{
name: 'notes',
path: '/notes',
component: NotesPage,
meta: {
title: 'Notes',
},
},
{
name: 'public-boards',
path: '/public-boards',
component: PublicBoardsPage,
meta: {
title: 'PublicBoards',
public: true,
},
},
{
name: 'profile',
path: '/profile',
component: ProfilePage,
meta: {
title: 'Profile',
},
},
{
name: 'edit-profile',
path: '/EditProfilePage',
component: EditProfilePage,
meta: {
title: 'Edit profile',
},
},
{
name: 'about',
path: '/about',
component: AboutPage,
meta: {
title: 'About',
},
},
{
name: 'releases',
path: '/releases',
component: ReleasesPage,
meta: {
title: 'Releases',
},
},
{
name: 'auth',
path: '/auth',
component: AuthPage,
meta: {
title: 'Auth',
public: true,
},
children: [
{
name: 'auth-provider',
path: ':provider',
component: AuthPage,
},
],
},
{
path: '/board/:id',
name: 'board',
component: BoardPage,
},
{
path: '/b/:id',
name: 'public-board',
component: BoardPage,
meta: {
public: true,
},
},
{
path: '/:userName',
name: 'public-profile',
component: PublicProfilePage,
meta: {
public: true,
},
},
{
path: '/privacy-policy',
name: 'privacy-policy-page',
component: PrivacyPolicyPage,
meta: {
public: true,
},
},
{
path: '/terms',
name: 'terms',
component: TermsPage,
meta: {
public: true,
},
},
{
name: 'home',
path: '/',
component: BoardsPage,
meta: {
title: 'Home',
public: true,
},
},
{
path: '*',
component: NotFoundPage,
},
];
export default routes;