From 7e3b80359393e4fd859a330b33387a990b5e57a7 Mon Sep 17 00:00:00 2001 From: Nick Taras Date: Mon, 17 Jul 2023 11:34:19 +0100 Subject: [PATCH] fixes to active and passive examples --- .../src/TokenContextProvider.js | 3 --- .../src/components/BookingModal/index.js | 15 ++++----------- .../src/BookingModal/index.js | 5 ++--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js b/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js index 7c882255c..3dfe176d1 100644 --- a/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js +++ b/hotel-bogota-active-negotiation-website/src/TokenContextProvider.js @@ -32,9 +32,6 @@ const TokenContextProvider = (props) => { if (result.error) return; if (result.issuers) { setProof(result); - } else { - // legacy version output. - setProof(result.data); } window.negotiator.getUi().closeOverlay(); }); diff --git a/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js b/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js index 1f77c4889..8fcdb03f8 100644 --- a/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js +++ b/hotel-bogota-active-negotiation-website/src/components/BookingModal/index.js @@ -52,9 +52,9 @@ export default function BookingModal({room}) { const useToken = async () => { try { localStorage.setItem("booking-room-type", room.type); - if (tokenLength > 1) { - let multiTokenAuthRequest = []; - for (const key in tokens) { + let multiTokenAuthRequest = []; + for (const key in tokens) { + if (tokens[key].tokens) { tokens[key].tokens.forEach((token) => { multiTokenAuthRequest.push({ issuer: key, @@ -62,15 +62,8 @@ export default function BookingModal({room}) { }); }); } - await negotiator.authenticate(multiTokenAuthRequest); - } else { - // legacy - await negotiator.authenticate({ - issuer: collectionID, - unsignedToken: tokens[0] - }); } - + await negotiator.authenticate(multiTokenAuthRequest); setLoadingTokenProof(true); } catch (e) { console.error(e); diff --git a/hotel-bogota-passive-negotiation-website/src/BookingModal/index.js b/hotel-bogota-passive-negotiation-website/src/BookingModal/index.js index 4429c6c5a..d94ad68bd 100644 --- a/hotel-bogota-passive-negotiation-website/src/BookingModal/index.js +++ b/hotel-bogota-passive-negotiation-website/src/BookingModal/index.js @@ -59,7 +59,7 @@ export default function BookingModal({ // Close Modal const handleClose = () => { - // localStorage.removeItem("booking-room-type"); + localStorage.removeItem("booking-room-type"); setOpen(false); }; @@ -69,8 +69,7 @@ export default function BookingModal({ const viewPrice = price - discountOfferValue; useEffect(() => { - if (discount) { - // && localStorage.getItem("booking-room-type") === roomType) { + if (discount && localStorage.getItem("booking-room-type") === roomType) { localStorage.removeItem("booking-room-type"); setOpen(true); }