feat: use app router for site home

This commit is contained in:
DIYgod
2023-05-07 17:12:17 +01:00
parent d3f83e3090
commit 5d9194787b
26 changed files with 422 additions and 180 deletions
+38 -37
View File
@@ -371,45 +371,46 @@ export function useGetSummary(input: { cid?: string; lang?: string }) {
})
}
export function useGetMirrorXyz(input: { address?: string }) {
return useQuery(["getMirror", input.address], async () => {
const { getDefaultSlug } = await import("~/lib/default-slug")
// TODO
// export function useGetMirrorXyz(input: { address?: string }) {
// return useQuery(["getMirror", input.address], async () => {
// const { getDefaultSlug } = await import("~/lib/default-slug")
if (!input.address) {
return null
}
const response = await (
await fetch(
"/api/import/mirror.xyz?" +
new URLSearchParams({
...input,
} as any),
)
).json()
// if (!input.address) {
// return null
// }
// const response = await (
// await fetch(
// "/api/import/mirror.xyz?" +
// new URLSearchParams({
// ...input,
// } as any),
// )
// ).json()
return response?.data?.projectFeed?.posts?.map((post: any) => {
return {
title: post.title,
date_published: new Date(
post.publishedAtTimestamp * 1000,
).toISOString(),
slug: getDefaultSlug(post.title, post.digest),
tags: ["Mirror.xyz"],
content: post.body,
external_urls: [`https://mirror.xyz/${input.address}/${post.digest}`],
}
}) as {
title: string
type: string
size: number
date_published: string
slug: string
tags: string[]
content: string
external_urls: string[]
}[]
})
}
// return response?.data?.projectFeed?.posts?.map((post: any) => {
// return {
// title: post.title,
// date_published: new Date(
// post.publishedAtTimestamp * 1000,
// ).toISOString(),
// slug: getDefaultSlug(post.title, post.digest),
// tags: ["Mirror.xyz"],
// content: post.body,
// external_urls: [`https://mirror.xyz/${input.address}/${post.digest}`],
// }
// }) as {
// title: string
// type: string
// size: number
// date_published: string
// slug: string
// tags: string[]
// content: string
// external_urls: string[]
// }[]
// })
// }
export function useCheckMirror(characterId?: number) {
return useQuery(["checkMirror", characterId], async () => {