this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 20 lines 390 B view raw
1import { Post } from "@/modules/post/entities/Post" 2import { computed } from "vue" 3 4const byMostRecentFirst = (a: Post, b: Post) => { 5 if (!b.date) { 6 return 1 7 } 8 9 if (!a.date) { 10 return 1 11 } 12 13 return a.date <= b.date ? 1 : -1 14} 15 16export const usePosts = () => { 17 const posts = useDocuments<Post>("@/pages/posts") 18 19 return computed(() => posts.value.sort(byMostRecentFirst)) 20}