fix: change bad JSON.stringify:s
This commit is contained in:
@@ -51,11 +51,15 @@ export const accountPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!refsResponse.data) {
|
if (!refsResponse.data) {
|
||||||
|
const notFoundError = notFound(refsResponse)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.accountPage.refs not found error",
|
"contentstack.accountPage.refs not found error",
|
||||||
JSON.stringify({ query: { lang, uid }, error: refsResponse })
|
JSON.stringify({
|
||||||
|
query: { lang, uid },
|
||||||
|
error: { code: notFoundError.code },
|
||||||
|
})
|
||||||
)
|
)
|
||||||
throw notFound(refsResponse)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanedData = removeEmptyObjects(refsResponse.data)
|
const cleanedData = removeEmptyObjects(refsResponse.data)
|
||||||
@@ -93,14 +97,15 @@ export const accountPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.accountPage not found error",
|
"contentstack.accountPage not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { lang, uid },
|
query: { lang, uid },
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedAccountPage = validateAccountPageSchema.safeParse(
|
const validatedAccountPage = validateAccountPageSchema.safeParse(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { error } from "console"
|
||||||
|
|
||||||
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
|
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
|
||||||
import {
|
import {
|
||||||
GetCurrentFooter,
|
GetCurrentFooter,
|
||||||
@@ -42,11 +44,12 @@ export const baseQueryRouter = router({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.config not found 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(
|
const validatedContactConfigConfig = validateContactConfigSchema.safeParse(
|
||||||
@@ -101,16 +104,17 @@ export const baseQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.header not found error",
|
"contentstack.header not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: {
|
query: {
|
||||||
lang: input.lang,
|
lang: input.lang,
|
||||||
},
|
},
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedHeaderConfig = validateHeaderConfigSchema.safeParse(
|
const validatedHeaderConfig = validateHeaderConfigSchema.safeParse(
|
||||||
@@ -179,16 +183,17 @@ export const baseQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.footer not found error",
|
"contentstack.footer not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: {
|
query: {
|
||||||
lang: input.lang,
|
lang: input.lang,
|
||||||
},
|
},
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedFooterConfig = validateFooterConfigSchema.safeParse(
|
const validatedFooterConfig = validateFooterConfigSchema.safeParse(
|
||||||
|
|||||||
@@ -19,14 +19,15 @@ export const hotelPageQueryRouter = router({
|
|||||||
uid,
|
uid,
|
||||||
})
|
})
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.hotelPage not found error",
|
"contentstack.hotelPage not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { lang, uid },
|
query: { lang, uid },
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedHotelPage = validateHotelPageSchema.safeParse(response.data)
|
const validatedHotelPage = validateHotelPageSchema.safeParse(response.data)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!refsResponse.data) {
|
if (!refsResponse.data) {
|
||||||
|
const notFoundError = notFound(refsResponse)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.loyaltyPage.refs not found error",
|
"contentstack.loyaltyPage.refs not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -62,10 +63,10 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
lang,
|
lang,
|
||||||
uid,
|
uid,
|
||||||
},
|
},
|
||||||
error: JSON.stringify(refsResponse),
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(refsResponse)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanedData = removeEmptyObjects(refsResponse.data)
|
const cleanedData = removeEmptyObjects(refsResponse.data)
|
||||||
@@ -110,14 +111,15 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.loyaltyPage not found error",
|
"contentstack.loyaltyPage not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { lang, uid },
|
query: { lang, uid },
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const blocks = response.data.loyalty_page.blocks
|
const blocks = response.data.loyalty_page.blocks
|
||||||
|
|||||||
@@ -76,16 +76,17 @@ export const navigationQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!refsResponse.data) {
|
if (!refsResponse.data) {
|
||||||
|
const notFoundError = notFound(refsResponse)
|
||||||
console.error(
|
console.error(
|
||||||
"contentstack.myPages.navigation.refs not found error",
|
"contentstack.myPages.navigation.refs not found error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: {
|
query: {
|
||||||
lang,
|
lang,
|
||||||
},
|
},
|
||||||
error: refsResponse,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
throw notFound(refsResponse)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedMyPagesNavigationRefs =
|
const validatedMyPagesNavigationRefs =
|
||||||
@@ -127,13 +128,14 @@ export const navigationQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
const notFoundError = notFound(response)
|
||||||
console.error("contentstack.myPages.navigation not found error", {
|
console.error("contentstack.myPages.navigation not found error", {
|
||||||
query: {
|
query: {
|
||||||
lang,
|
lang,
|
||||||
},
|
},
|
||||||
error: response,
|
error: { code: notFoundError.code },
|
||||||
})
|
})
|
||||||
throw notFound(response)
|
throw notFoundError
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedMyPagesNavigation = navigationPayloadSchema.safeParse(
|
const validatedMyPagesNavigation = navigationPayloadSchema.safeParse(
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ export const hotelQueryRouter = router({
|
|||||||
"api.hotels.hotel error",
|
"api.hotels.hotel error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { hotelId, params: params.toString() },
|
query: { hotelId, params: params.toString() },
|
||||||
error: apiResponse,
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
|||||||
console.error(
|
console.error(
|
||||||
"api.user.profile error",
|
"api.user.profile error",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
error: apiResponse,
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
if (apiResponse.status === 401) {
|
if (apiResponse.status === 401) {
|
||||||
@@ -303,7 +306,12 @@ export const userQueryRouter = router({
|
|||||||
if (!previousStaysResponse.ok) {
|
if (!previousStaysResponse.ok) {
|
||||||
console.error(
|
console.error(
|
||||||
"api.booking.stays.past error",
|
"api.booking.stays.past error",
|
||||||
JSON.stringify({ error: previousStaysResponse })
|
JSON.stringify({
|
||||||
|
error: {
|
||||||
|
status: previousStaysResponse.status,
|
||||||
|
statusText: previousStaysResponse.statusText,
|
||||||
|
},
|
||||||
|
})
|
||||||
)
|
)
|
||||||
return notLoggedInUserTrackingData
|
return notLoggedInUserTrackingData
|
||||||
}
|
}
|
||||||
@@ -383,7 +391,10 @@ export const userQueryRouter = router({
|
|||||||
"api.booking.stays.past error ",
|
"api.booking.stays.past error ",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { params: params.toString() },
|
query: { params: params.toString() },
|
||||||
error: apiResponse,
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
@@ -463,7 +474,10 @@ export const userQueryRouter = router({
|
|||||||
"api.booking.stays.future error ",
|
"api.booking.stays.future error ",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
query: { params: params.toString() },
|
query: { params: params.toString() },
|
||||||
error: apiResponse,
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
@@ -532,7 +546,12 @@ export const userQueryRouter = router({
|
|||||||
// }
|
// }
|
||||||
console.error(
|
console.error(
|
||||||
"api.transaction.friendTransactions error ",
|
"api.transaction.friendTransactions error ",
|
||||||
JSON.stringify({ error: apiResponse })
|
JSON.stringify({
|
||||||
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
|
})
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -628,7 +647,12 @@ export const userQueryRouter = router({
|
|||||||
if (!apiResponse.ok) {
|
if (!apiResponse.ok) {
|
||||||
console.error(
|
console.error(
|
||||||
"api.profile.creditCards error ",
|
"api.profile.creditCards error ",
|
||||||
JSON.stringify({ error: apiResponse })
|
JSON.stringify({
|
||||||
|
error: {
|
||||||
|
status: apiResponse.status,
|
||||||
|
statusText: apiResponse.statusText,
|
||||||
|
},
|
||||||
|
})
|
||||||
)
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user