mirror of
https://github.com/axllent/mailpit.git
synced 2025-01-10 00:43:53 +02:00
6a4e5fb03c
See #156
38 lines
748 B
JavaScript
38 lines
748 B
JavaScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import MailboxView from '../views/MailboxView.vue'
|
|
import MessageView from '../views/MessageView.vue'
|
|
import NotFoundView from '../views/NotFoundView.vue'
|
|
import SearchView from '../views/SearchView.vue'
|
|
|
|
let d = document.getElementById('app')
|
|
let webroot = '/'
|
|
if (d) {
|
|
webroot = d.dataset.webroot
|
|
}
|
|
|
|
// paths are relative to webroot
|
|
const router = createRouter({
|
|
history: createWebHistory(webroot),
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
component: MailboxView
|
|
},
|
|
{
|
|
path: '/search',
|
|
component: SearchView
|
|
},
|
|
{
|
|
path: '/view/:id',
|
|
component: MessageView
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)*',
|
|
name: 'NotFound',
|
|
component: NotFoundView
|
|
}
|
|
]
|
|
})
|
|
|
|
export default router
|