vikunja-frontend/src/router/index.js

164 lines
3.9 KiB
JavaScript
Raw Normal View History

import Vue from 'vue'
import Router from 'vue-router'
import HomeComponent from '@/components/Home'
2020-03-02 20:30:49 +01:00
import NotFoundComponent from '@/components/404'
2018-09-08 22:27:13 +02:00
// User Handling
import LoginComponent from '@/components/user/Login'
import RegisterComponent from '@/components/user/Register'
2018-11-01 22:34:29 +01:00
import PasswordResetComponent from '@/components/user/PasswordReset'
import GetPasswordResetComponent from '@/components/user/RequestPasswordReset'
import UserSettingsComponent from '@/components/user/Settings'
2018-09-08 23:33:23 +02:00
// List Handling
import ShowListComponent from '@/components/lists/ShowList'
2018-09-09 21:28:07 +02:00
import NewListComponent from '@/components/lists/NewList'
import EditListComponent from '@/components/lists/EditList'
2019-04-29 23:41:39 +02:00
import ShowTasksInRangeComponent from '@/components/tasks/ShowTasksInRange'
2019-09-09 19:55:43 +02:00
import LinkShareAuthComponent from '@/components/sharing/linkSharingAuth'
2019-11-24 14:16:24 +01:00
import TaskDetailViewComponent from '@/components/tasks/TaskDetailView'
2018-09-11 19:20:07 +02:00
// Namespace Handling
import NewNamespaceComponent from '@/components/namespaces/NewNamespace'
2018-09-11 19:46:14 +02:00
import EditNamespaceComponent from '@/components/namespaces/EditNamespace'
// Team Handling
import ListTeamsComponent from '@/components/teams/ListTeams'
import EditTeamComponent from '@/components/teams/EditTeam'
2018-09-14 19:19:50 +02:00
import NewTeamComponent from '@/components/teams/NewTeam'
2019-03-07 20:48:40 +01:00
// Label Handling
import ListLabelsComponent from '@/components/labels/ListLabels'
// Migration
import MigrationComponent from '../components/migrator/migrate'
import WunderlistMigrationComponent from '../components/migrator/wunderlist'
Vue.use(Router)
export default new Router({
2019-03-07 20:48:40 +01:00
mode: 'history',
2019-10-20 21:40:44 +02:00
scrollBehavior (to, from, savedPosition) {
// If the user is using their forward/backward keys to navigate, we want to restore the scroll view
if(savedPosition) {
return savedPosition
}
// Scroll to anchor should still work
if(to.hash) {
return {
selector: to.hash
}
}
// Otherwise just scroll to the top
return { x: 0, y: 0 }
},
2019-03-07 20:48:40 +01:00
routes: [
{
path: '/',
name: 'home',
component: HomeComponent
},
2020-03-02 20:30:49 +01:00
{
path: '*',
name: '404',
component: NotFoundComponent,
},
2019-03-07 20:48:40 +01:00
{
path: '/login',
name: 'login',
component: LoginComponent
},
{
path: '/get-password-reset',
name: 'getPasswordReset',
component: GetPasswordResetComponent
},
{
path: '/password-reset',
name: 'passwordReset',
component: PasswordResetComponent
},
{
path: '/register',
name: 'register',
component: RegisterComponent
},
{
path: '/lists/:id',
name: 'showList',
component: ShowListComponent
},
{
path: '/lists/:id/edit',
name: 'editList',
component: EditListComponent
},
2019-04-29 23:41:39 +02:00
{
path: '/lists/:id/:type',
name: 'showListWithType',
component: ShowListComponent,
},
2019-03-07 20:48:40 +01:00
{
path: '/namespaces/:id/list',
name: 'newList',
component: NewListComponent
},
{
path: '/namespaces/new',
name: 'newNamespace',
component: NewNamespaceComponent
},
{
path: '/namespaces/:id/edit',
name: 'editNamespace',
component: EditNamespaceComponent
},
{
path: '/teams',
name: 'listTeams',
component: ListTeamsComponent
},
{
path: '/teams/new',
name: 'newTeam',
component: NewTeamComponent
},
{
path: '/teams/:id/edit',
name: 'editTeam',
component: EditTeamComponent
},
{
2019-11-24 14:16:24 +01:00
path: '/tasks/by/:type',
2019-03-07 20:48:40 +01:00
name: 'showTasksInRange',
component: ShowTasksInRangeComponent
},
2019-11-24 14:16:24 +01:00
{
path: '/tasks/:id',
name: 'taskDetailView',
component: TaskDetailViewComponent,
},
2019-03-07 20:48:40 +01:00
{
path: '/labels',
name: 'listLabels',
component: ListLabelsComponent
2019-09-09 19:55:43 +02:00
},
{
path: '/share/:share/auth',
name: 'linkShareAuth',
component: LinkShareAuthComponent
},
{
path: '/migrate',
name: 'migrateStart',
component: MigrationComponent,
},
{
path: '/migrate/wunderlist',
name: 'migrateWunderlist',
component: WunderlistMigrationComponent,
},
{
path: '/user/settings',
name: 'userSettings',
component: UserSettingsComponent,
},
2019-03-07 20:48:40 +01:00
]
})