Skip to content

Commit

Permalink
Merge pull request #227 from TokenScript/feat/wip-multi-auth
Browse files Browse the repository at this point in the history
fixes to active and passive examples
  • Loading branch information
nicktaras committed Jul 17, 2023
2 parents 2221f5a + 7e3b803 commit ae4344b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,18 @@ 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,
unsignedToken: token
});
});
}
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function BookingModal({

// Close Modal
const handleClose = () => {
// localStorage.removeItem("booking-room-type");
localStorage.removeItem("booking-room-type");
setOpen(false);
};

Expand All @@ -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);
}
Expand Down

0 comments on commit ae4344b

Please sign in to comment.