updated to next 9.3.0
This commit is contained in:
1 parent
6c6c9f91ca
commit
01acda1e04
8 files changed
+478
-217
No files matched your search
+3
-3
@@ -51,13 +51,13 @@ export class MetaBuilder {
|
||||
}
|
||||
|
||||
build() {
|
||||
const image = this.buildImage()
|
||||
const image = this.buildImage()
|
||||
|
||||
return meta({
|
||||
...this.data,
|
||||
...image,
|
||||
title: this.title ?? undefined,
|
||||
description: this.description ?? undefined,
|
||||
title: this.title ?? null,
|
||||
description: this.description ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+4
-18
@@ -1,5 +1,5 @@
|
||||
import { createApiUrl, requestGet, IResponseItems } from './next-lib'
|
||||
import { IPage, PageCardData } from './types'
|
||||
import { IPage, PageCardData, PageCardDto } from './types'
|
||||
import { queryList } from './lib/url'
|
||||
|
||||
export type QuerySlice = {
|
||||
@@ -19,15 +19,7 @@ export async function getPagesByTags<T = IPage>(tags: string[], { skip, limit, s
|
||||
return res?.items
|
||||
}
|
||||
|
||||
export async function getPagesCardsByTags(tags: string[]): Promise<PageCardData[]> {
|
||||
type ResponseItem = {
|
||||
url: string
|
||||
title: string
|
||||
featured: boolean
|
||||
date: string
|
||||
coverSrc: string
|
||||
}
|
||||
|
||||
export async function getPagesCardsByTags(tags: string[]): Promise<PageCardDto[]> {
|
||||
const skip = 0
|
||||
const limit = 1000
|
||||
const fields = [
|
||||
@@ -38,16 +30,10 @@ export async function getPagesCardsByTags(tags: string[]): Promise<PageCardData[
|
||||
'coverSrc'
|
||||
]
|
||||
|
||||
const items = await getPagesByTags<ResponseItem>(tags, { fields, skip, limit, sortBy: '-date' })
|
||||
const items = await getPagesByTags<PageCardDto>(tags, { fields, skip, limit, sortBy: '-date' })
|
||||
if (!Array.isArray(items)) {
|
||||
return []
|
||||
}
|
||||
|
||||
return items.map(item => ({
|
||||
url: item.url,
|
||||
title: item.title,
|
||||
featured: item.featured,
|
||||
date: new Date(item.date),
|
||||
coverSrc: item.coverSrc,
|
||||
}))
|
||||
return items
|
||||
}
|
||||
@@ -16,6 +16,14 @@ export type PageCardData = {
|
||||
coverSrc?: string
|
||||
}
|
||||
|
||||
export type PageCardDto = {
|
||||
url: string
|
||||
title: string
|
||||
featured: boolean
|
||||
date: string
|
||||
coverSrc: string
|
||||
}
|
||||
|
||||
export interface IPage {
|
||||
id: string
|
||||
title: string
|
||||
|
||||
Reference in new issue
Block a user