Add new path to locate content blocks
This commit is contained in:
parent
c879c074dc
commit
afefc7f31e
|
|
@ -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>
|
||||
|
|
@ -104,7 +104,6 @@ const routes = [
|
|||
},
|
||||
];
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
routes,
|
||||
history: createWebHistory(),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue