fix filter and fetch

Signed-off-by: nurRiyad <asadnurriyad@gmail.com>
This commit is contained in:
nurRiyad
2022-12-23 02:08:59 +06:00
parent f5021ebe06
commit acbbc595b2
2 changed files with 4 additions and 6 deletions

View File

@@ -11,12 +11,11 @@ const path = computed(() => {
return route.path || ""; return route.path || "";
}); });
const { data } = await useAsyncData("page-data", () => const data = useState("blogData");
queryContent(`${path.value}`).findOne()
);
const content = computed(() => { const content = computed(() => {
return data.value as ParsedContent; const allpost = (data.value as Array<ParsedContent>) || [];
return allpost.find((post) => post._path === path.value) || {};
}); });
</script> </script>

View File

@@ -12,8 +12,7 @@ const getTopCategory = computed(() => {
dir: post._dir, dir: post._dir,
}; };
}); });
const uniqType = new Set(alltypes); return [...new Map(alltypes.map((item) => [item["dir"], item])).values()];
return uniqType;
}); });
// get all post in recent time order // get all post in recent time order