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

View File

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