Skip to content

Commit 45bc1c6

Browse files
committed
Fix the BMS UI link - show based on the endpoint (stage or prod)
1 parent 0f170ab commit 45bc1c6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

index.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ const EQUIPMENT_FIELD_IDS = {
2525
LARGEKIDSBIKE: 1006,
2626
}
2727

28-
// const endpoint = 'https://bmsstage.bonzabiketours.com:3001/octo/v1/';
29-
3028
const CONCURRENCY = 3; // is this ok ?
3129

3230
const isNilOrEmpty = R.either(R.isNil, R.isEmpty);
@@ -361,6 +359,11 @@ class Plugin {
361359
assert(R.path(['surname'], holder), 'a holder\' surname is required');
362360
assert(R.path(['emailAddress'], holder), 'a holder\' email is required');
363361

362+
let uiEndPoint = "https://bms.bonzabiketours.com/";
363+
if (endpoint.includes("bmsstage")) {
364+
uiEndPoint = "https://bmsstage.bonzabiketours.com/";
365+
}
366+
364367
const inputDataForBooking = await jwt.verify(availabilityKey, this.jwtKey);
365368
console.log("OPTION ID: " + inputDataForBooking.optionId);
366369

@@ -586,8 +589,9 @@ class Plugin {
586589
headers,
587590
}));
588591

589-
console.log("booking: " + JSON.stringify(booking));
592+
// console.log("booking: " + JSON.stringify(booking));
590593

594+
// console.log("uiEndPoint: " + uiEndPoint);
591595
// Get the booking
592596
let newBooking = R.path(['data'], await axios({
593597
method: 'get',
@@ -599,6 +603,7 @@ class Plugin {
599603
booking: await translateBooking({
600604
rootValue: {
601605
...newBooking,
606+
uiEndPoint
602607
},
603608
typeDefs: bookingTypeDefs,
604609
query: bookingQuery,
@@ -696,6 +701,11 @@ class Plugin {
696701
apiKey: apiKey,
697702
});
698703

704+
let uiEndPoint = "https://bms.bonzabiketours.com/";
705+
if (endpoint.includes("bmsstage")) {
706+
uiEndPoint = "https://bmsstage.bonzabiketours.com/";
707+
}
708+
699709
const bookingsFound = await (async () => {
700710
if (!isNilOrEmpty(bookingId)) {
701711
console.log("BookingID: calling search by URL");
@@ -767,6 +777,7 @@ class Plugin {
767777
return translateBooking({
768778
rootValue: {
769779
...booking,
780+
uiEndPoint
770781
// product,
771782
// option: product.options.find(o => o.optionId === booking.optionId),
772783
},

resolvers/booking.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const resolvers = {
7777
// optionName: ({ option }) => option ? option.internalName : '',
7878
// resellerReference: R.propOr('', 'id'),
7979
privateUrl: root => {
80-
return `https://bmsstage.bonzabiketours.com/purchases/edit-tour/${root.id}`
80+
return `${root.uiEndPoint}purchases/edit-tour/${root.id}`
8181
},
8282
},
8383
};

0 commit comments

Comments
 (0)