Merged in feat/SW-1076-no-room-availability (pull request #1467)
Feat/SW-1076 no room availability * fix: update booking error codes * feat(SW-1076): handle no room availabilty on enter-details * fix: parse to json in api mutation instead of expecting json * fix: remove 'isComplete' state from sectionAccordion because it was not needed Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { metrics } from "@opentelemetry/api"
|
||||
import sjson from "secure-json-parse"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { getVerifiedUser } from "@/server/routers/user/query"
|
||||
@@ -11,8 +12,8 @@ import {
|
||||
cancelBookingInput,
|
||||
createBookingInput,
|
||||
priceChangeInput,
|
||||
updateBookingInput,
|
||||
removePackageInput,
|
||||
updateBookingInput,
|
||||
} from "./input"
|
||||
import { createBookingSchema } from "./output"
|
||||
|
||||
@@ -135,10 +136,17 @@ export const bookingMutationRouter = router({
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
error: text,
|
||||
text,
|
||||
},
|
||||
})
|
||||
)
|
||||
|
||||
const apiJson = sjson.safeParse(text)
|
||||
if ("errors" in apiJson && apiJson.errors.length) {
|
||||
const error = apiJson.errors[0]
|
||||
return { error: true, cause: error.code } as const
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user