Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Petry committed Oct 6, 2023
1 parent 1b616b7 commit 99e10e0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 38 deletions.
61 changes: 28 additions & 33 deletions composables/data.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,60 @@
import { fetchContentNavigation, queryContent, useAsyncData } from '#imports'
import { fetchContentNavigation, queryContent, useAsyncData } from "#imports";
import type {
GeneralList,
JsonParsedContent,
Page,
Post,
ProjectList,
} from '~/types'
import { groupBy } from '~/logic'
} from "~/types";
import { groupBy } from "~/logic";

export function useProjects() {
return useAsyncData('content:projects', () =>
queryContent<JsonParsedContent<ProjectList>>('_projects').findOne())
return useAsyncData("content:projects", () =>
queryContent<JsonParsedContent<ProjectList>>("_projects").findOne()
);
}

export function useGeneralList() {
return useAsyncData('content:entrys', () =>
queryContent<JsonParsedContent<GeneralList>>('_partners').findOne())
}

export function useGeneralList() {
return useAsyncData('content:entrys', () =>
queryContent<JsonParsedContent<GeneralList>>('_partners').findOne(),
)
return useAsyncData("content:entrys", () =>
queryContent<JsonParsedContent<GeneralList>>("_partners").findOne()
);
}

export function useHeaderNav() {
return useAsyncData('content:navigation', () => fetchContentNavigation())
return useAsyncData("content:navigation", () => fetchContentNavigation());
}
export function usePostList() {
return useAsyncData(
'content:post-partials',
"content:post-partials",
() =>
queryContent<Post>()
.where({ _path: /blog\/*/ })
.without(['head', 'body', 'excerpt', '_'])
.without(["head", "body", "excerpt", "_"])
.sort({
publishedAt: -1,
})
.find(),
{
// group posts by the publish year
transform: posts =>
groupBy(posts, p => new Date(p.publishedAt).getFullYear()),
},
)
transform: (posts) =>
groupBy(posts, (p) => new Date(p.publishedAt).getFullYear()),
}
);
}

export function useRoutesContent<T extends Post>(path?: string) {
if (!path)
path = useRoute().path
return useAsyncData(`content:${path}`, () => queryContent<T>()
.where({ path: new RegExp(path) })
.without(['excerpt'])
.findOne())
if (!path) path = useRoute().path;
return useAsyncData(`content:${path}`, () =>
queryContent<T>()
.where({ path: new RegExp(path) })
.without(["excerpt"])
.findOne()
);
}

export const usePost = async (path?: string) => useRoutesContent<Post>(path)
export const usePage = async (path?: string) => useRoutesContent<Page>(path)
function
// group posts by the publish year
transform(input: Omit<Post, string>[]): {} {
throw new Error('Function not implemented.')
export const usePost = async (path?: string) => useRoutesContent<Post>(path);
export const usePage = async (path?: string) => useRoutesContent<Page>(path);
function // group posts by the publish year
transform(input: Omit<Post, string>[]): {} {
throw new Error("Function not implemented.");
}

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
"@iconify-json/logos": "^1.1.37",
"@iconify-json/mdi": "^1.1.54",
"@iconify-json/noto": "^1.1.12",
"@iconify-json/octicon": "^1.1.43",
"@iconify-json/octicon": "^1.1.49",
"@iconify-json/ph": "^1.1.6",
"@iconify-json/ri": "^1.1.12",
"@iconify-json/simple-icons": "^1.1.72",
"@iconify-json/uim": "^1.1.6",
"@iconify-json/vscode-icons": "^1.1.28",
"@nuxt-themes/docus": "^1.14.9",
"@nuxt/content": "^2.8.5",
Expand Down
17 changes: 13 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99e10e0

Please sign in to comment.