Merged in feat/SW-1442-destination-overview-page (pull request #1188)
feat(SW-1442): added destination overview page * feat(SW-1442): added destination overview page Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { edgeRequest } from "@/lib/graphql/edgeRequest"
|
||||
import { ResolveEntryByUrl } from "@/lib/graphql/Query/ResolveEntry.graphql"
|
||||
import { batchEdgeRequest } from "@/lib/graphql/batchEdgeRequest"
|
||||
import {
|
||||
EntryByUrlBatch1,
|
||||
EntryByUrlBatch2,
|
||||
} from "@/lib/graphql/Query/ResolveEntry.graphql"
|
||||
import { internalServerError } from "@/server/errors/next"
|
||||
|
||||
import { validateEntryResolveSchema } from "@/types/requests/entry"
|
||||
|
||||
export async function resolve(url: string, lang = Lang.en) {
|
||||
const response = await edgeRequest(
|
||||
ResolveEntryByUrl,
|
||||
const variables = { locale: lang, url }
|
||||
const response = await batchEdgeRequest([
|
||||
{
|
||||
locale: lang,
|
||||
url,
|
||||
document: EntryByUrlBatch1,
|
||||
variables,
|
||||
},
|
||||
{
|
||||
next: {
|
||||
revalidate: 3600,
|
||||
},
|
||||
}
|
||||
)
|
||||
document: EntryByUrlBatch2,
|
||||
variables,
|
||||
},
|
||||
])
|
||||
|
||||
const validatedData = validateEntryResolveSchema.safeParse(response.data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user