Skip to content
Snippets Groups Projects
Commit 90492f22 authored by simon.mellerin's avatar simon.mellerin
Browse files

Use route name everywhere + add authentification guard

parent 16f26f8e
Branches
No related tags found
1 merge request!36Route naming
Pipeline #10355 passed
......@@ -12,8 +12,6 @@ import type { RouteLocationAsRelativeGeneric } from 'vue-router'
const { locale } = useI18n()
// const props = defineProps<RouterLinkProps>()
const props = defineProps({
to: {
type: Object as PropType<RouteLocationAsRelativeGeneric>,
......
......@@ -20,7 +20,7 @@ export const useCommunityData = defineBasicLoader(
// @see https://uvr.esm.is/data-loaders/navigation-aware.html#navigation-aware
// As DataLoader is an experimental feature, I let it like this for now.
router.push({
name: 'error',
name: 'catchall',
params: {
lang: locale.value,
path: 'error'
......
......@@ -30,7 +30,7 @@
<route lang="json">
{
"name": "error"
"name": "catchall"
}
</route>
......
......@@ -36,7 +36,7 @@ router.beforeResolve((to) => {
i18n.global.locale.value = language
} else {
return {
name: `error`,
name: `catchall`,
params: {
lang: i18n.global.locale.value,
path: 'error'
......@@ -77,7 +77,7 @@ router.beforeEach(async (to) => {
if (!accountStore.isAuthenticated) {
router.push({
name: 'error',
name: 'catchall',
params: {
lang: i18n.global.locale.value,
path: 'error'
......
......@@ -19,7 +19,7 @@ declare module 'vue-router/auto-routes' {
*/
export interface RouteNamedMap {
'index': RouteRecordInfo<'index', '/:lang', Record<never, never>, Record<never, never>>,
'error': RouteRecordInfo<'error', '/:lang/:path(.*)', { path: ParamValue<true> }, { path: ParamValue<false> }>,
'catchall': RouteRecordInfo<'catchall', '/:lang/:path(.*)', { path: ParamValue<true> }, { path: ParamValue<false> }>,
'/:lang/community/[community]': RouteRecordInfo<'/:lang/community/[community]', '/:lang/community/:community', { community: ParamValue<true> }, { community: ParamValue<false> }>,
'community': RouteRecordInfo<'community', '/:lang/community/:community', { community: ParamValue<true> }, { community: ParamValue<false> }>,
'community.resource': RouteRecordInfo<'community.resource', '/:lang/community/:community/resource/:identifier', { community: ParamValue<true>, identifier: ParamValue<true> }, { community: ParamValue<false>, identifier: ParamValue<false> }>,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment