Add new path to locate content blocks

This commit is contained in:
Ramon Wenger 2023-02-06 14:30:06 +01:00
parent c879c074dc
commit afefc7f31e
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
<template>
<div>
<h1>ContentBlockLocator {{ props.id }}</h1>
<pre>{{ result }}</pre>
</div>
</template>
<script setup lang="ts">
import {useQuery} from '@vue/apollo-composable';
import gql from 'graphql-tag';
import {useRouter} from 'vue-router';
const router = useRouter();
const props = defineProps < {
id: string;
} > ();
const {result, onResult} = useQuery(gql`
query {
contentBlock(id: "${props.id}") {
path
}
}
`);
onResult(
({
data: {
contentBlock: {path},
},
}) => {
// console.log(queryResult);
router.push(`/${path}`);
}
);
</script>

View File

@ -104,7 +104,6 @@ const routes = [
},
];
const router = createRouter({
routes,
history: createWebHistory(),

View File

@ -20,6 +20,7 @@ const moduleVisibility = () => import(/* webpackChunkName: "modules" */ '@/pages
const settingsPage = () => import(/* webpackChunkName: "modules" */ '@/pages/module/moduleSettings');
const snapshots = () => import(/* webpackChunkName: "modules" */ '@/pages/snapshot/snapshots');
const snapshot = () => import(/* webpackChunkName: "modules" */ '@/pages/snapshot/snapshot');
const contentBlockLocator = () => import(/* webpackChunkName: "modules" */ '@/pages/contentBlockLocator.vue');
const contentBlockFormMeta = {
// layout: LAYOUT_SIMPLE,
@ -109,4 +110,9 @@ export default [
},
],
},
{
path: '/content/:id',
props: true,
component: contentBlockLocator,
},
];