diff --git a/app.vue b/app.vue index cd2edad..2ed14e6 100644 --- a/app.vue +++ b/app.vue @@ -9,6 +9,15 @@ function hideLeftPanel(_: Event): void { \ No newline at end of file diff --git a/components/LeftComponent.vue b/components/LeftComponent.vue index 222bff8..79a58e0 100644 --- a/components/LeftComponent.vue +++ b/components/LeftComponent.vue @@ -5,14 +5,27 @@ function hideLeftPanel(_: Event) } const route = useRoute(); +const showing = ref(false); -const project = parseInt(Array.isArray(route.params.projectId) ? '' : route.params.projectId); +const project = computed(() => parseInt(Array.isArray(route.params.projectId) ? '0' : route.params.projectId)); -const { data: navigation } = await useFetch(() => isNaN(project) ? '' : `/api/project/${project}/navigation`); +const { data: navigation, execute, status, error } = await useFetch(() => `/api/project/${project.value}/navigation`, { + immediate: false, +}); + +if(route.params.projectId && project.value !== 0) +{ + showing.value = true; + execute(); +} +else +{ + showing.value = false; +} @@ -74,22 +74,30 @@ if (parseURL(props.href).protocol !== undefined) let id = ref(props.project); if(id.value === undefined) { - id = useProject().id; + id.value = useProject().id.value; } const { data: page, status, error, execute } = await useLazyFetch(`/api/project/${id.value}/file`, { query: { search: "%" + parseURL(props.href).pathname, - } + }, + immediate: false, + dedupe: 'defer', }); -if(external.value) +if(!external.value) { - execute(); + await execute(); +} + +if(status.value === 'error') +{ + console.error(error.value); } if (page.value && page.value[0]) { path.value = `/explorer/${id.value}${page.value[0].path}`; + console.log(path.value); } \ No newline at end of file diff --git a/components/explorer/NavigationLink.vue b/components/explorer/NavigationLink.vue index 80fb1eb..1f2abde 100644 --- a/components/explorer/NavigationLink.vue +++ b/components/explorer/NavigationLink.vue @@ -51,7 +51,7 @@ function hideLeftPanel(_: Event) -
{{ link.title }}
diff --git a/components/explorer/TocLink.vue b/components/explorer/TocLink.vue index 38b0ec7..a7399c1 100644 --- a/components/explorer/TocLink.vue +++ b/components/explorer/TocLink.vue @@ -19,7 +19,7 @@ const hasChildren = computed(() => {