fix: structure logged data
This commit is contained in:
@@ -8,7 +8,12 @@ import { HotelPage, HotelPageDataRaw, validateHotelPageSchema } from "./output"
|
||||
export const hotelPageQueryRouter = router({
|
||||
get: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||
const { lang, uid } = ctx
|
||||
console.info("contentstack.hotelPage start ", JSON.stringify({ lang, uid }))
|
||||
console.info(
|
||||
"contentstack.hotelPage start",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
const response = await request<HotelPageDataRaw>(GetHotelPage, {
|
||||
locale: lang,
|
||||
uid,
|
||||
@@ -16,7 +21,10 @@ export const hotelPageQueryRouter = router({
|
||||
if (!response.data) {
|
||||
console.error(
|
||||
"contentstack.hotelPage not found error",
|
||||
JSON.stringify({ lang, uid })
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: response,
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
}
|
||||
@@ -26,8 +34,10 @@ export const hotelPageQueryRouter = router({
|
||||
if (!validatedHotelPage.success) {
|
||||
console.error(
|
||||
"contentstack.hotelPage validation error",
|
||||
JSON.stringify({ lang, uid }),
|
||||
JSON.stringify(validatedHotelPage.error)
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: validatedHotelPage.error,
|
||||
})
|
||||
)
|
||||
return null
|
||||
}
|
||||
@@ -35,7 +45,12 @@ export const hotelPageQueryRouter = router({
|
||||
const hotelPage = {
|
||||
...validatedHotelPage.data.hotel_page,
|
||||
} as HotelPage
|
||||
|
||||
console.info(
|
||||
"contentstack.hotelPage success",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
return hotelPage
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user