Merged in feat/SW-3549-handle-unlinked-account (pull request #3019)
fix(SW-3549): update social session management functions for clarity and consistency * refactor(SW-3549): rename session management functions for clarity and consistency * merge Approved-by: Hrishikesh Vaipurkar
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
getBookingStatusInput,
|
||||
getLinkedReservationsInput,
|
||||
} from "./input"
|
||||
import { findBooking, getBooking, isPartnerLoggedInUser } from "./utils"
|
||||
import { findBooking, getBooking } from "./utils"
|
||||
|
||||
const refIdPlugin = createRefIdPlugin()
|
||||
|
||||
@@ -31,10 +31,7 @@ export const bookingQueryRouter = router({
|
||||
.concat(refIdPlugin.toConfirmationNumber)
|
||||
.use(async ({ ctx, input, next }) => {
|
||||
const lang = input.lang ?? ctx.lang
|
||||
const token =
|
||||
isValidSession(ctx.session) && !isPartnerLoggedInUser(ctx.session)
|
||||
? ctx.session.token.access_token
|
||||
: ctx.serviceToken
|
||||
const token = await ctx.getScandicUserToken()
|
||||
|
||||
return next({
|
||||
ctx: {
|
||||
@@ -51,7 +48,11 @@ export const bookingQueryRouter = router({
|
||||
|
||||
metricsGetBooking.start()
|
||||
|
||||
const booking = await getBooking(confirmationNumber, lang, token)
|
||||
const booking = await getBooking(
|
||||
confirmationNumber,
|
||||
lang,
|
||||
token ?? serviceToken
|
||||
)
|
||||
|
||||
if (!booking) {
|
||||
metricsGetBooking.dataError(
|
||||
|
||||
Reference in New Issue
Block a user