fix: add improved logging for contentstack requests
This commit is contained in:
@@ -67,7 +67,7 @@ export const accountPageQueryRouter = router({
|
|||||||
generateTags(lang, connections),
|
generateTags(lang, connections),
|
||||||
generateTag(lang, validatedAccountPageRefs.data.account_page.system.uid),
|
generateTag(lang, validatedAccountPageRefs.data.account_page.system.uid),
|
||||||
].flat()
|
].flat()
|
||||||
|
console.info("contentstack.accountPage start ", { lang, uid })
|
||||||
const response = await request<AccountPageDataRaw>(
|
const response = await request<AccountPageDataRaw>(
|
||||||
GetAccountPage,
|
GetAccountPage,
|
||||||
{
|
{
|
||||||
@@ -78,6 +78,7 @@ export const accountPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error("contentstack.accountPage not found error", { lang, uid })
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,11 +87,13 @@ export const accountPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!validatedAccountPage.success) {
|
if (!validatedAccountPage.success) {
|
||||||
console.error(`Failed to validate Account Page - (uid: ${uid})`)
|
console.error(
|
||||||
console.error(validatedAccountPage.error)
|
"contentstack.accountPage validation error",
|
||||||
|
JSON.stringify(validatedAccountPage.error)
|
||||||
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.accountPage success ", { lang, uid })
|
||||||
// TODO: Make returned data nicer
|
// TODO: Make returned data nicer
|
||||||
const content = validatedAccountPage.data.account_page.content.map(
|
const content = validatedAccountPage.data.account_page.content.map(
|
||||||
(block) => {
|
(block) => {
|
||||||
|
|||||||
@@ -33,12 +33,17 @@ import {
|
|||||||
export const baseQueryRouter = router({
|
export const baseQueryRouter = router({
|
||||||
contact: contentstackBaseProcedure.query(async ({ ctx }) => {
|
contact: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||||
const { lang } = ctx
|
const { lang } = ctx
|
||||||
|
console.info("contentstack.config start ", JSON.stringify({ lang }))
|
||||||
const response = await request<ContactConfigData>(GetContactConfig, {
|
const response = await request<ContactConfigData>(GetContactConfig, {
|
||||||
locale: lang,
|
locale: lang,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error(
|
||||||
|
"contentstack.config not found error ",
|
||||||
|
JSON.stringify({ lang }),
|
||||||
|
JSON.stringify(response)
|
||||||
|
)
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,21 +53,33 @@ export const baseQueryRouter = router({
|
|||||||
|
|
||||||
if (!validatedContactConfigConfig.success) {
|
if (!validatedContactConfigConfig.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate Contact Config Data - (lang: ${ctx.lang})`
|
"contentstack.config validation error ",
|
||||||
|
JSON.stringify({ lang }),
|
||||||
|
JSON.stringify(validatedContactConfigConfig.error)
|
||||||
)
|
)
|
||||||
console.error(validatedContactConfigConfig.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.config success ", JSON.stringify({ lang }))
|
||||||
return validatedContactConfigConfig.data.all_contact_config.items[0]
|
return validatedContactConfigConfig.data.all_contact_config.items[0]
|
||||||
}),
|
}),
|
||||||
header: contentstackBaseProcedure
|
header: contentstackBaseProcedure
|
||||||
.input(langInput)
|
.input(langInput)
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
|
console.info(
|
||||||
|
"contentstack.header.ref start ",
|
||||||
|
JSON.stringify({ lang: input.lang })
|
||||||
|
)
|
||||||
const responseRef = await request<HeaderRefDataRaw>(GetCurrentHeaderRef, {
|
const responseRef = await request<HeaderRefDataRaw>(GetCurrentHeaderRef, {
|
||||||
locale: input.lang,
|
locale: input.lang,
|
||||||
})
|
})
|
||||||
|
console.info(
|
||||||
|
"contentstack.header. start ",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
// There's currently no error handling/validation for the responseRef, should it be added?
|
||||||
const response = await request<HeaderDataRaw>(
|
const response = await request<HeaderDataRaw>(
|
||||||
GetCurrentHeader,
|
GetCurrentHeader,
|
||||||
{ locale: input.lang },
|
{ locale: input.lang },
|
||||||
@@ -77,6 +94,13 @@ export const baseQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error(
|
||||||
|
"contentstack.header not found error ",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
}),
|
||||||
|
JSON.stringify(response)
|
||||||
|
)
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +109,21 @@ export const baseQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!validatedHeaderConfig.success) {
|
if (!validatedHeaderConfig.success) {
|
||||||
console.error(`Failed to validate Header - (lang: ${input.lang})`)
|
console.error(
|
||||||
console.error(validatedHeaderConfig.error)
|
"contentstack.header validation error",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
}),
|
||||||
|
JSON.stringify(validatedHeaderConfig.error)
|
||||||
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info(
|
||||||
|
"contentstack.header success ",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
})
|
||||||
|
)
|
||||||
const logo =
|
const logo =
|
||||||
validatedHeaderConfig.data.all_current_header.items[0].logoConnection
|
validatedHeaderConfig.data.all_current_header.items[0].logoConnection
|
||||||
.edges?.[0]?.node
|
.edges?.[0]?.node
|
||||||
@@ -102,10 +136,17 @@ export const baseQueryRouter = router({
|
|||||||
footer: contentstackBaseProcedure
|
footer: contentstackBaseProcedure
|
||||||
.input(langInput)
|
.input(langInput)
|
||||||
.query(async ({ input }) => {
|
.query(async ({ input }) => {
|
||||||
|
console.info("contentstack.footer.ref start ", { lang: input.lang })
|
||||||
const responseRef = await request<FooterRefDataRaw>(GetCurrentFooterRef, {
|
const responseRef = await request<FooterRefDataRaw>(GetCurrentFooterRef, {
|
||||||
locale: input.lang,
|
locale: input.lang,
|
||||||
})
|
})
|
||||||
|
// There's currently no error handling/validation for the responseRef, should it be added?
|
||||||
|
console.info(
|
||||||
|
"contentstack.footer start ",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
})
|
||||||
|
)
|
||||||
const response = await request<FooterDataRaw>(
|
const response = await request<FooterDataRaw>(
|
||||||
GetCurrentFooter,
|
GetCurrentFooter,
|
||||||
{
|
{
|
||||||
@@ -121,16 +162,30 @@ export const baseQueryRouter = router({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (!response.data) {
|
||||||
|
console.error(
|
||||||
|
"contentstack.footer not found error ",
|
||||||
|
JSON.stringify({
|
||||||
|
lang: input.lang,
|
||||||
|
}),
|
||||||
|
JSON.stringify(response)
|
||||||
|
)
|
||||||
|
throw notFound(response)
|
||||||
|
}
|
||||||
|
|
||||||
const validatedFooterConfig = validateFooterConfigSchema.safeParse(
|
const validatedFooterConfig = validateFooterConfigSchema.safeParse(
|
||||||
response.data
|
response.data
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!validatedFooterConfig.success) {
|
if (!validatedFooterConfig.success) {
|
||||||
console.error(`Failed to validate Footer - (lang: ${input.lang})`)
|
console.error(
|
||||||
console.error(validatedFooterConfig.error)
|
"contentstack.footer validation error",
|
||||||
|
JSON.stringify({ lang: input.lang }),
|
||||||
|
JSON.stringify(validatedFooterConfig.error)
|
||||||
|
)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.footer success ", { lang: input.lang })
|
||||||
return validatedFooterConfig.data.all_current_footer.items[0]
|
return validatedFooterConfig.data.all_current_footer.items[0]
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,11 +8,16 @@ import { HotelPage, HotelPageDataRaw, validateHotelPageSchema } from "./output"
|
|||||||
export const hotelPageQueryRouter = router({
|
export const hotelPageQueryRouter = router({
|
||||||
get: contentstackBaseProcedure.query(async ({ ctx }) => {
|
get: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||||
const { lang, uid } = ctx
|
const { lang, uid } = ctx
|
||||||
|
console.info("contentstack.hotelPage start ", JSON.stringify({ lang, uid }))
|
||||||
const response = await request<HotelPageDataRaw>(GetHotelPage, {
|
const response = await request<HotelPageDataRaw>(GetHotelPage, {
|
||||||
locale: lang,
|
locale: lang,
|
||||||
uid,
|
uid,
|
||||||
})
|
})
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error(
|
||||||
|
"contentstack.hotelPage not found error",
|
||||||
|
JSON.stringify({ lang, uid })
|
||||||
|
)
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,9 +25,10 @@ export const hotelPageQueryRouter = router({
|
|||||||
|
|
||||||
if (!validatedHotelPage.success) {
|
if (!validatedHotelPage.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate Hotel Page - (uid: ${uid}, lang: ${lang})`
|
"contentstack.hotelPage validation error",
|
||||||
|
JSON.stringify({ lang, uid }),
|
||||||
|
JSON.stringify(validatedHotelPage.error)
|
||||||
)
|
)
|
||||||
console.error(validatedHotelPage.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ export const languageSwitcherQueryRouter = router({
|
|||||||
if (!ctx.uid || !ctx.lang) {
|
if (!ctx.uid || !ctx.lang) {
|
||||||
return { lang: ctx.lang, urls: baseUrls }
|
return { lang: ctx.lang, urls: baseUrls }
|
||||||
}
|
}
|
||||||
|
console.info(
|
||||||
|
"contentstack.languageSwitcher start ",
|
||||||
|
JSON.stringify({
|
||||||
|
uid: ctx.uid,
|
||||||
|
lang: ctx.lang,
|
||||||
|
contentType: ctx.contentType,
|
||||||
|
})
|
||||||
|
)
|
||||||
const res = await getLanguageSwitcher({
|
const res = await getLanguageSwitcher({
|
||||||
contentType: ctx.contentType!,
|
contentType: ctx.contentType!,
|
||||||
uid: ctx.uid,
|
uid: ctx.uid,
|
||||||
@@ -155,12 +163,12 @@ export const languageSwitcherQueryRouter = router({
|
|||||||
|
|
||||||
if (!validatedLanguageSwitcherData.success) {
|
if (!validatedLanguageSwitcherData.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate Language Switcher Data - (contentType: ${ctx.contentType}, lang: ${ctx.lang}, uid: ${ctx.uid})`
|
"contentstack.languageSwitcher validation error",
|
||||||
|
JSON.stringify(validatedLanguageSwitcherData.error)
|
||||||
)
|
)
|
||||||
console.error(validatedLanguageSwitcherData.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.languageSwitcher success")
|
||||||
return {
|
return {
|
||||||
lang: ctx.lang,
|
lang: ctx.lang,
|
||||||
urls,
|
urls,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import {
|
|||||||
export const loyaltyPageQueryRouter = router({
|
export const loyaltyPageQueryRouter = router({
|
||||||
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||||
const { lang, uid } = ctx
|
const { lang, uid } = ctx
|
||||||
|
console.info("contentstack.loyaltyPage.refs start ", { lang, uid })
|
||||||
const refsResponse = await request<LoyaltyPageRefsDataRaw>(
|
const refsResponse = await request<LoyaltyPageRefsDataRaw>(
|
||||||
GetLoyaltyPageRefs,
|
GetLoyaltyPageRefs,
|
||||||
{
|
{
|
||||||
@@ -50,6 +50,10 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!refsResponse.data) {
|
if (!refsResponse.data) {
|
||||||
|
console.error("contentstack.loyaltyPage.refs not found error", {
|
||||||
|
lang,
|
||||||
|
uid,
|
||||||
|
})
|
||||||
throw notFound(refsResponse)
|
throw notFound(refsResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,19 +63,20 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
validateLoyaltyPageRefsSchema.safeParse(cleanedData)
|
validateLoyaltyPageRefsSchema.safeParse(cleanedData)
|
||||||
if (!validatedLoyaltyPageRefs.success) {
|
if (!validatedLoyaltyPageRefs.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate Loyaltypage Refs - (lang: ${lang}, uid: ${uid})`
|
"contentstack.loyaltyPage.refs validation error",
|
||||||
|
{ lang, uid },
|
||||||
|
JSON.stringify(validatedLoyaltyPageRefs.error)
|
||||||
)
|
)
|
||||||
console.error(validatedLoyaltyPageRefs.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.loyaltyPage.refs success ", { lang, uid })
|
||||||
const connections = getConnections(validatedLoyaltyPageRefs.data)
|
const connections = getConnections(validatedLoyaltyPageRefs.data)
|
||||||
|
|
||||||
const tags = [
|
const tags = [
|
||||||
generateTags(lang, connections),
|
generateTags(lang, connections),
|
||||||
generateTag(lang, validatedLoyaltyPageRefs.data.loyalty_page.system.uid),
|
generateTag(lang, validatedLoyaltyPageRefs.data.loyalty_page.system.uid),
|
||||||
].flat()
|
].flat()
|
||||||
|
console.info("contentstack.loyaltyPage start ", { lang, uid })
|
||||||
const response = await request<any>(
|
const response = await request<any>(
|
||||||
GetLoyaltyPage,
|
GetLoyaltyPage,
|
||||||
{
|
{
|
||||||
@@ -82,6 +87,7 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error("contentstack.loyaltyPage not found error", { lang, uid })
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,9 +197,10 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
validateLoyaltyPageSchema.safeParse(loyaltyPage)
|
validateLoyaltyPageSchema.safeParse(loyaltyPage)
|
||||||
if (!validatedLoyaltyPage.success) {
|
if (!validatedLoyaltyPage.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate Loyaltypage Data - (lang: ${lang}, uid: ${uid})`
|
"contentstack.loyaltyPage validation error",
|
||||||
|
{ lang, uid },
|
||||||
|
JSON.stringify(validatedLoyaltyPage.error)
|
||||||
)
|
)
|
||||||
console.error(validatedLoyaltyPage.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +212,7 @@ export const loyaltyPageQueryRouter = router({
|
|||||||
channel: TrackingChannelEnum["scandic-friends"],
|
channel: TrackingChannelEnum["scandic-friends"],
|
||||||
pageType: "loyaltycontentpage",
|
pageType: "loyaltycontentpage",
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.loyaltyPage success ", { lang, uid })
|
||||||
// Assert LoyaltyPage type to get correct typings for RTE fields
|
// Assert LoyaltyPage type to get correct typings for RTE fields
|
||||||
return {
|
return {
|
||||||
loyaltyPage,
|
loyaltyPage,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function mapMenuItems(menuItems: MenuItems) {
|
|||||||
export const navigationQueryRouter = router({
|
export const navigationQueryRouter = router({
|
||||||
get: contentstackBaseProcedure.query(async function ({ ctx }) {
|
get: contentstackBaseProcedure.query(async function ({ ctx }) {
|
||||||
const { lang } = ctx
|
const { lang } = ctx
|
||||||
|
console.info("contentstack.myPages.navigation.ref start ", { lang })
|
||||||
const refsResponse = await request<GetNavigationMyPagesRefsData>(
|
const refsResponse = await request<GetNavigationMyPagesRefsData>(
|
||||||
GetNavigationMyPagesRefs,
|
GetNavigationMyPagesRefs,
|
||||||
{ locale: lang },
|
{ locale: lang },
|
||||||
@@ -71,19 +71,21 @@ export const navigationQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!refsResponse.data) {
|
if (!refsResponse.data) {
|
||||||
|
console.error("contentstack.myPages.navigation.ref not found error ", {
|
||||||
|
lang,
|
||||||
|
})
|
||||||
throw notFound(refsResponse)
|
throw notFound(refsResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
const validatedMyPagesNavigationRefs =
|
const validatedMyPagesNavigationRefs =
|
||||||
navigationRefsPayloadSchema.safeParse(refsResponse.data)
|
navigationRefsPayloadSchema.safeParse(refsResponse.data)
|
||||||
if (!validatedMyPagesNavigationRefs.success) {
|
if (!validatedMyPagesNavigationRefs.success) {
|
||||||
console.error(
|
console.error("contentstack.myPages.navigation.ref validation error ", {
|
||||||
`Failed to validate My Pages Navigation Refs - (lang: ${lang}`
|
lang,
|
||||||
)
|
})
|
||||||
console.error(validatedMyPagesNavigationRefs.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
console.info("contentstack.myPages.navigation.ref success ", { lang })
|
||||||
const connections = getConnections(validatedMyPagesNavigationRefs.data)
|
const connections = getConnections(validatedMyPagesNavigationRefs.data)
|
||||||
|
|
||||||
const tags = [
|
const tags = [
|
||||||
@@ -94,7 +96,7 @@ export const navigationQueryRouter = router({
|
|||||||
.system.uid
|
.system.uid
|
||||||
),
|
),
|
||||||
].flat()
|
].flat()
|
||||||
|
console.info("contentstack.myPages.navigation start ", { lang })
|
||||||
const response = await request<GetNavigationMyPagesData>(
|
const response = await request<GetNavigationMyPagesData>(
|
||||||
GetNavigationMyPages,
|
GetNavigationMyPages,
|
||||||
{ locale: lang },
|
{ locale: lang },
|
||||||
@@ -102,6 +104,9 @@ export const navigationQueryRouter = router({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
|
console.error("contentstack.myPages.navigation not found error ", {
|
||||||
|
lang,
|
||||||
|
})
|
||||||
throw notFound(response)
|
throw notFound(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,9 +115,10 @@ export const navigationQueryRouter = router({
|
|||||||
)
|
)
|
||||||
if (!validatedMyPagesNavigation.success) {
|
if (!validatedMyPagesNavigation.success) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to validate My Pages Navigation Data - (lang: ${lang}`
|
"contentstack.myPages.navigation validation error ",
|
||||||
|
JSON.stringify({ lang }),
|
||||||
|
JSON.stringify(validatedMyPagesNavigation.error)
|
||||||
)
|
)
|
||||||
console.error(validatedMyPagesNavigation.error)
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const hotelQueryRouter = router({
|
|||||||
params.include = include.join(",")
|
params.include = include.join(",")
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("api.hotels.hotel start")
|
console.info("api.hotels.hotel start")
|
||||||
const apiResponse = await api.get(
|
const apiResponse = await api.get(
|
||||||
`${api.endpoints.v1.hotels}/${hotelId}`,
|
`${api.endpoints.v1.hotels}/${hotelId}`,
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ export const hotelQueryRouter = router({
|
|||||||
return validatedRoom.data
|
return validatedRoom.data
|
||||||
})
|
})
|
||||||
: []
|
: []
|
||||||
console.log("api.hotels.hotel success")
|
console.info("api.hotels.hotel success")
|
||||||
return {
|
return {
|
||||||
hotel: validatedHotelData.data.data.attributes,
|
hotel: validatedHotelData.data.data.attributes,
|
||||||
roomCategories: roomCategories,
|
roomCategories: roomCategories,
|
||||||
@@ -90,12 +90,13 @@ export const hotelQueryRouter = router({
|
|||||||
// const apiLang = toApiLang(language)
|
// const apiLang = toApiLang(language)
|
||||||
// params.set("hotelId", hotelId.toString())
|
// params.set("hotelId", hotelId.toString())
|
||||||
// params.set("language", apiLang)
|
// params.set("language", apiLang)
|
||||||
console.log("api.hotels.rates start")
|
console.info("api.hotels.rates start")
|
||||||
const validatedHotelData = getRatesSchema.safeParse(tempRatesData)
|
const validatedHotelData = getRatesSchema.safeParse(tempRatesData)
|
||||||
|
|
||||||
if (!tempRatesData) {
|
if (!tempRatesData) {
|
||||||
console.error("api.hotels.rates error, ", {})
|
console.error("api.hotels.rates error, ", {})
|
||||||
return null
|
//Can't return null here since consuming component does not handle null yet
|
||||||
|
// return null
|
||||||
}
|
}
|
||||||
if (!validatedHotelData.success) {
|
if (!validatedHotelData.success) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -104,17 +105,18 @@ export const hotelQueryRouter = router({
|
|||||||
)
|
)
|
||||||
throw badRequestError()
|
throw badRequestError()
|
||||||
}
|
}
|
||||||
console.log("api.hotels.rates success")
|
console.info("api.hotels.rates success")
|
||||||
return validatedHotelData.data
|
return validatedHotelData.data
|
||||||
}),
|
}),
|
||||||
getFilters: publicProcedure
|
getFilters: publicProcedure
|
||||||
.input(getFiltersInputSchema)
|
.input(getFiltersInputSchema)
|
||||||
.query(async ({ input, ctx }) => {
|
.query(async ({ input, ctx }) => {
|
||||||
console.log("api.hotels.filters start")
|
console.info("api.hotels.filters start")
|
||||||
|
|
||||||
if (!tempFilterData) {
|
if (!tempFilterData) {
|
||||||
console.error("api.hotels.filters error, ", {})
|
console.error("api.hotels.filters error, ", {})
|
||||||
return null
|
//Can't return null here since consuming component does not handle null yet
|
||||||
|
// return null
|
||||||
}
|
}
|
||||||
const validateFilterData = getFiltersSchema.safeParse(tempFilterData)
|
const validateFilterData = getFiltersSchema.safeParse(tempFilterData)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user