fix: change bad JSON.stringify:s

This commit is contained in:
Arvid Norlin
2024-08-22 15:27:51 +02:00
parent 8340f1ff6c
commit 7cd6367c15
7 changed files with 69 additions and 27 deletions

View File

@@ -1,3 +1,5 @@
import { error } from "console"
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
import {
GetCurrentFooter,
@@ -42,11 +44,12 @@ export const baseQueryRouter = router({
})
if (!response.data) {
const notFoundError = notFound(response)
console.error(
"contentstack.config not found error",
JSON.stringify({ query: { lang }, error: response })
JSON.stringify({ query: { lang }, error: { code: notFoundError.code } })
)
throw notFound(response)
throw notFoundError
}
const validatedContactConfigConfig = validateContactConfigSchema.safeParse(
@@ -101,16 +104,17 @@ export const baseQueryRouter = router({
)
if (!response.data) {
const notFoundError = notFound(response)
console.error(
"contentstack.header not found error",
JSON.stringify({
query: {
lang: input.lang,
},
error: response,
error: { code: notFoundError.code },
})
)
throw notFound(response)
throw notFoundError
}
const validatedHeaderConfig = validateHeaderConfigSchema.safeParse(
@@ -179,16 +183,17 @@ export const baseQueryRouter = router({
)
if (!response.data) {
const notFoundError = notFound(response)
console.error(
"contentstack.footer not found error",
JSON.stringify({
query: {
lang: input.lang,
},
error: response,
error: { code: notFoundError.code },
})
)
throw notFound(response)
throw notFoundError
}
const validatedFooterConfig = validateFooterConfigSchema.safeParse(